From 2a4656ba0d3dd4f13a7de10c3e8ca837651902f8 Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Wed, 20 Jun 2007 16:54:49 +0000 Subject: [PATCH 01/57] Initial import to devel --- .cvsignore | 1 + schroedinger.spec | 86 +++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 88 insertions(+) create mode 100644 schroedinger.spec diff --git a/.cvsignore b/.cvsignore index e69de29..6263739 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +schroedinger-0.6.1.tar.gz diff --git a/schroedinger.spec b/schroedinger.spec new file mode 100644 index 0000000..dd48bba --- /dev/null +++ b/schroedinger.spec @@ -0,0 +1,86 @@ +%define abi 0.1 + +Name: schroedinger +Version: 0.6.1 +Release: 2%{?dist} +Summary: Portable libraries for the high quality Dirac video codec + +Group: System Environment/Libraries +License: LGPL/MIT/MPL +URL: http://schrodinger.sourceforge.net/ +Source0: http://download.sourceforge.net/%{name}/%{name}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: liboil-devel >= 0.3.12 +BuildRequires: gstreamer-devel >= 0.10 +BuildRequires: gstreamer-plugins-base-devel >= 0.10 +BuildRequires: gtk-doc + +%description +The Schrödinger project will implement portable libraries for the high +quality Dirac video codec created by BBC Research and +Development. Dirac is a free and open source codec producing very high +image quality video. + +The Schrödinger project is a project done by BBC R&D and Fluendo in +order to create a set of high quality decoder and encoder libraries +for the Dirac video codec. + +%package devel +Group: Development/Libraries +Summary: Development files for schrodinger +Requires: %{name} = %{version}-%{release} +Requires: pkgconfig + +%description devel +Development files for schrodinger + +%package -n gstreamer-plugins-schroedinger +Group: Applications/Multimedia +Summary: GStreamer Plugins that implement Dirac video encoding and decoding + +%description -n gstreamer-plugins-schroedinger +GStreamer Plugins that implement Dirac video encoding and decoding + +%prep +%setup -q + +%build +%configure --disable-static --enable-gtk-doc +make %{?_smp_mflags} + +%install +rm -rf %{buildroot} +make install DESTDIR=%{buildroot} +find %{buildroot} -name \*.la -delete + +%clean +rm -rf %{buildroot} + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root,-) +%doc ChangeLog COPYING* NEWS TODO +%{_libdir}/libschroedinger-%{abi}.so.* + +%files devel +%defattr(-,root,root,-) +%doc %{_datadir}/gtk-doc/html/schroedinger-%{abi} +%{_includedir}/schroedinger-%{abi} +%{_libdir}/*.so +%{_libdir}/pkgconfig/schroedinger-%{abi}.pc + +%files -n gstreamer-plugins-schroedinger +%defattr(-,root,root,-) +%{_libdir}/gstreamer-0.10/libgstschro.so + +%changelog +* Wed Jun 20 2007 Jeffrey C. Ollie - 0.6.1-2 +- Fix license field +- Add pkgconfig as a requirement for the devel subpackage + +* Sun Jun 10 2007 Jeffrey C. Ollie - 0.6.1-1 +- First version for Fedora diff --git a/sources b/sources index e69de29..b6c351e 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +66cb093505f9d56068e80ebc4e674275 schroedinger-0.6.1.tar.gz From 48bfacafc5d4529563e20dec74f9a52ffff8d36b Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Wed, 29 Aug 2007 04:26:12 +0000 Subject: [PATCH 02/57] - Rebuild for selinux ppc32 issue. --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index dd48bba..ecba4ce 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 0.6.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -78,6 +78,9 @@ rm -rf %{buildroot} %{_libdir}/gstreamer-0.10/libgstschro.so %changelog +* Wed Aug 29 2007 Fedora Release Engineering - 0.6.1-3 +- Rebuild for selinux ppc32 issue. + * Wed Jun 20 2007 Jeffrey C. Ollie - 0.6.1-2 - Fix license field - Add pkgconfig as a requirement for the devel subpackage From 9317ad99be3bc65c3c2b3e58b8a50d41fe3be04d Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Mon, 12 Nov 2007 21:53:56 +0000 Subject: [PATCH 03/57] Update to 0.9.0 --- .cvsignore | 2 +- schroedinger.spec | 9 ++++++--- sources | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.cvsignore b/.cvsignore index 6263739..8c78bfc 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -schroedinger-0.6.1.tar.gz +schroedinger-0.9.0.tar.gz diff --git a/schroedinger.spec b/schroedinger.spec index ecba4ce..bc8f81b 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -1,8 +1,8 @@ -%define abi 0.1 +%define abi 0.9 Name: schroedinger -Version: 0.6.1 -Release: 3%{?dist} +Version: 0.9.0 +Release: 1%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -78,6 +78,9 @@ rm -rf %{buildroot} %{_libdir}/gstreamer-0.10/libgstschro.so %changelog +* Mon Nov 12 2007 Jeffrey C. Ollie - 0.9.0-1 +- Update to 0.9.0 + * Wed Aug 29 2007 Fedora Release Engineering - 0.6.1-3 - Rebuild for selinux ppc32 issue. diff --git a/sources b/sources index b6c351e..20c1dc0 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -66cb093505f9d56068e80ebc4e674275 schroedinger-0.6.1.tar.gz +06aff4ff30a9a6ac05b3ba4f35398779 schroedinger-0.9.0.tar.gz From 36a464844570b8dd917312630b0bea9ea85a99d4 Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Mon, 11 Feb 2008 20:28:43 +0000 Subject: [PATCH 04/57] Rebuild for GCC 4.3 --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index bc8f81b..f8fe422 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 0.9.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -78,6 +78,9 @@ rm -rf %{buildroot} %{_libdir}/gstreamer-0.10/libgstschro.so %changelog +* Mon Feb 11 2008 Jeffrey C. Ollie - 0.9.0-2 +- Rebuild for GCC 4.3 + * Mon Nov 12 2007 Jeffrey C. Ollie - 0.9.0-1 - Update to 0.9.0 From 22ee1e4bb8d6b55200f6b5128d58176c9595a9ab Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Sat, 23 Feb 2008 05:02:08 +0000 Subject: [PATCH 05/57] Update to 1.0.0 --- .cvsignore | 2 +- schroedinger.spec | 16 ++++++++++------ sources | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.cvsignore b/.cvsignore index 8c78bfc..49af664 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -schroedinger-0.9.0.tar.gz +schroedinger-1.0.0.tar.gz diff --git a/schroedinger.spec b/schroedinger.spec index f8fe422..fba311a 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -1,17 +1,18 @@ -%define abi 0.9 +%define abi 1.0 Name: schroedinger -Version: 0.9.0 -Release: 2%{?dist} +Version: 1.0.0 +Release: 1%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries License: LGPL/MIT/MPL URL: http://schrodinger.sourceforge.net/ -Source0: http://download.sourceforge.net/%{name}/%{name}-%{version}.tar.gz +Source0: http://diracvideo.schleef.org/download/schroedinger/schroedinger-%{version}.tar.gz +#Source0: http://download.sourceforge.net/%{name}/%{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: liboil-devel >= 0.3.12 +BuildRequires: liboil-devel >= 0.3.13 BuildRequires: gstreamer-devel >= 0.10 BuildRequires: gstreamer-plugins-base-devel >= 0.10 BuildRequires: gtk-doc @@ -63,7 +64,7 @@ rm -rf %{buildroot} %files %defattr(-,root,root,-) -%doc ChangeLog COPYING* NEWS TODO +%doc COPYING* NEWS TODO %{_libdir}/libschroedinger-%{abi}.so.* %files devel @@ -78,6 +79,9 @@ rm -rf %{buildroot} %{_libdir}/gstreamer-0.10/libgstschro.so %changelog +* Fri Feb 22 2008 Jeffrey C. Ollie - 1.0.0-1 +- Update to 1.0.0 + * Mon Feb 11 2008 Jeffrey C. Ollie - 0.9.0-2 - Rebuild for GCC 4.3 diff --git a/sources b/sources index 20c1dc0..5ad2aa2 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -06aff4ff30a9a6ac05b3ba4f35398779 schroedinger-0.9.0.tar.gz +dfe538484b476085904a36c3140e1265 schroedinger-1.0.0.tar.gz From c31f198df10dd7b79f4c969086466e8c303fdd08 Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Fri, 27 Jun 2008 13:34:17 +0000 Subject: [PATCH 06/57] - Update to 1.0.3. - Update URLs. --- .cvsignore | 2 +- schroedinger.spec | 13 ++++++++----- sources | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.cvsignore b/.cvsignore index 49af664..268e5c8 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -schroedinger-1.0.0.tar.gz +schroedinger-1.0.3.tar.gz diff --git a/schroedinger.spec b/schroedinger.spec index fba311a..7bd6f8e 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -1,15 +1,14 @@ %define abi 1.0 Name: schroedinger -Version: 1.0.0 +Version: 1.0.3 Release: 1%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries License: LGPL/MIT/MPL -URL: http://schrodinger.sourceforge.net/ -Source0: http://diracvideo.schleef.org/download/schroedinger/schroedinger-%{version}.tar.gz -#Source0: http://download.sourceforge.net/%{name}/%{name}-%{version}.tar.gz +URL: http://www.diracvideo.org/ +Source0: http://www.diracvideo.org/download/schroedinger/schroedinger-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: liboil-devel >= 0.3.13 @@ -69,7 +68,7 @@ rm -rf %{buildroot} %files devel %defattr(-,root,root,-) -%doc %{_datadir}/gtk-doc/html/schroedinger-%{abi} +%doc %{_datadir}/gtk-doc/html/schroedinger %{_includedir}/schroedinger-%{abi} %{_libdir}/*.so %{_libdir}/pkgconfig/schroedinger-%{abi}.pc @@ -79,6 +78,10 @@ rm -rf %{buildroot} %{_libdir}/gstreamer-0.10/libgstschro.so %changelog +* Fri Jun 27 2008 Jeffrey C. Ollie - 1.0.3-1 +- Update to 1.0.3. +- Update URLs. + * Fri Feb 22 2008 Jeffrey C. Ollie - 1.0.0-1 - Update to 1.0.0 diff --git a/sources b/sources index 5ad2aa2..7fcf95f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -dfe538484b476085904a36c3140e1265 schroedinger-1.0.0.tar.gz +c46ac18acfc55089fbd94d43fddd3f56 schroedinger-1.0.3.tar.gz From d6f314e445372080097708ff6b55f39b56e5d07d Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Thu, 3 Jul 2008 02:15:57 +0000 Subject: [PATCH 07/57] - Devel subpackage needs to require liboil-devel. --- schroedinger.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index 7bd6f8e..68ba1b4 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -31,6 +31,7 @@ Group: Development/Libraries Summary: Development files for schrodinger Requires: %{name} = %{version}-%{release} Requires: pkgconfig +Requires: liboil-devel %description devel Development files for schrodinger @@ -78,6 +79,9 @@ rm -rf %{buildroot} %{_libdir}/gstreamer-0.10/libgstschro.so %changelog +* Fri Jul 2 2008 Jeffrey C. Ollie - 1.0.3-2 +- Devel subpackage needs to require liboil-devel. + * Fri Jun 27 2008 Jeffrey C. Ollie - 1.0.3-1 - Update to 1.0.3. - Update URLs. From fee2ee2449fb8b70c2a64583bfa4f4eba12ec0da Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Wed, 27 Aug 2008 19:14:31 +0000 Subject: [PATCH 08/57] - Update to 1.0.5 --- .cvsignore | 2 +- schroedinger.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.cvsignore b/.cvsignore index 268e5c8..77ee45d 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -schroedinger-1.0.3.tar.gz +schroedinger-1.0.5.tar.gz diff --git a/schroedinger.spec b/schroedinger.spec index 68ba1b4..d4cc127 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -1,8 +1,8 @@ %define abi 1.0 Name: schroedinger -Version: 1.0.3 -Release: 2%{?dist} +Version: 1.0.5 +Release: 1%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -79,6 +79,9 @@ rm -rf %{buildroot} %{_libdir}/gstreamer-0.10/libgstschro.so %changelog +* Wed Aug 27 2008 Jeffrey C. Ollie - 1.0.5-1 +- Update to 1.0.5 + * Fri Jul 2 2008 Jeffrey C. Ollie - 1.0.3-2 - Devel subpackage needs to require liboil-devel. diff --git a/sources b/sources index 7fcf95f..c67c395 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -c46ac18acfc55089fbd94d43fddd3f56 schroedinger-1.0.3.tar.gz +55596c41572c5efcf4b2cae9c68c2152 schroedinger-1.0.5.tar.gz From 1e8daac8927b83f8f6b65c27c2dc24c2b13d85ba Mon Sep 17 00:00:00 2001 From: Tom Callaway Date: Thu, 4 Sep 2008 15:37:39 +0000 Subject: [PATCH 09/57] fix license tag --- schroedinger.spec | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/schroedinger.spec b/schroedinger.spec index d4cc127..0fd2735 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,11 +2,12 @@ Name: schroedinger Version: 1.0.5 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries -License: LGPL/MIT/MPL +# No version is given for the GPL or the LGPL +License: GPL+ or LGPLv2+ or MIT or MPLv1.1 URL: http://www.diracvideo.org/ Source0: http://www.diracvideo.org/download/schroedinger/schroedinger-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -79,6 +80,9 @@ rm -rf %{buildroot} %{_libdir}/gstreamer-0.10/libgstschro.so %changelog +* Thu Sep 4 2008 Tom "spot" Callaway - 1.0.5-2 +- fix license tag + * Wed Aug 27 2008 Jeffrey C. Ollie - 1.0.5-1 - Update to 1.0.5 From 2b915d5fd25c7dd46e3678f884e2e028aba0f45c Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Mon, 15 Sep 2008 13:17:51 +0000 Subject: [PATCH 10/57] - Bump release and rebuild against latest gstreamer-* packages to pick - up special gstreamer codec provides. --- schroedinger.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index 0fd2735..05042b9 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.5 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -80,6 +80,10 @@ rm -rf %{buildroot} %{_libdir}/gstreamer-0.10/libgstschro.so %changelog +* Fri Sep 12 2008 Jeffrey C. Ollie - 1.0.5-3 +- Bump release and rebuild against latest gstreamer-* packages to pick +- up special gstreamer codec provides. + * Thu Sep 4 2008 Tom "spot" Callaway - 1.0.5-2 - fix license tag From 92e9b94ffe8ddca59af868589eb076e38dec93ba Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Thu, 30 Oct 2008 03:54:34 +0000 Subject: [PATCH 11/57] - Fix some typos [BZ#469133] --- schroedinger.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/schroedinger.spec b/schroedinger.spec index 05042b9..13640c4 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.5 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -29,13 +29,13 @@ for the Dirac video codec. %package devel Group: Development/Libraries -Summary: Development files for schrodinger +Summary: Development files for schroedinger Requires: %{name} = %{version}-%{release} Requires: pkgconfig Requires: liboil-devel %description devel -Development files for schrodinger +Development files for schroedinger %package -n gstreamer-plugins-schroedinger Group: Applications/Multimedia @@ -80,6 +80,9 @@ rm -rf %{buildroot} %{_libdir}/gstreamer-0.10/libgstschro.so %changelog +* Wed Oct 29 2008 Jeffrey C. Ollie - 1.0.5-4 +- Fix some typos [BZ#469133] + * Fri Sep 12 2008 Jeffrey C. Ollie - 1.0.5-3 - Bump release and rebuild against latest gstreamer-* packages to pick - up special gstreamer codec provides. From 3dba402c9e8b0f1562f45f3a5d4fcebc4c87ee3b Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Wed, 25 Feb 2009 22:55:20 +0000 Subject: [PATCH 12/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index 13640c4..0da976f 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.5 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -80,6 +80,9 @@ rm -rf %{buildroot} %{_libdir}/gstreamer-0.10/libgstschro.so %changelog +* Wed Feb 25 2009 Fedora Release Engineering - 1.0.5-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + * Wed Oct 29 2008 Jeffrey C. Ollie - 1.0.5-4 - Fix some typos [BZ#469133] From cecb9cb9eb74968cc2bd28ef41779511870c5c67 Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Thu, 2 Apr 2009 13:58:15 +0000 Subject: [PATCH 13/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild --- .cvsignore | 2 +- schroedinger.spec | 8 ++++---- sources | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.cvsignore b/.cvsignore index 77ee45d..4ec522e 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -schroedinger-1.0.5.tar.gz +schroedinger-1.0.6.tar.gz diff --git a/schroedinger.spec b/schroedinger.spec index 0da976f..a2b9f32 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -1,8 +1,8 @@ %define abi 1.0 Name: schroedinger -Version: 1.0.5 -Release: 5%{?dist} +Version: 1.0.6 +Release: 1%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -12,7 +12,7 @@ URL: http://www.diracvideo.org/ Source0: http://www.diracvideo.org/download/schroedinger/schroedinger-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: liboil-devel >= 0.3.13 +BuildRequires: liboil-devel >= 0.3.16 BuildRequires: gstreamer-devel >= 0.10 BuildRequires: gstreamer-plugins-base-devel >= 0.10 BuildRequires: gtk-doc @@ -32,7 +32,7 @@ Group: Development/Libraries Summary: Development files for schroedinger Requires: %{name} = %{version}-%{release} Requires: pkgconfig -Requires: liboil-devel +Requires: liboil-devel >= 0.3.16 %description devel Development files for schroedinger diff --git a/sources b/sources index c67c395..397a029 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -55596c41572c5efcf4b2cae9c68c2152 schroedinger-1.0.5.tar.gz +e5d0f34d623f6fc3bbf9468c48935c97 schroedinger-1.0.6.tar.gz From 3be12881fa7fa96922fcd8a90d1bf1d99c729c96 Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Fri, 24 Apr 2009 14:40:00 +0000 Subject: [PATCH 14/57] - Update to 1.0.7 --- .cvsignore | 2 +- schroedinger.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.cvsignore b/.cvsignore index 4ec522e..cba2932 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -schroedinger-1.0.6.tar.gz +schroedinger-1.0.7.tar.gz diff --git a/schroedinger.spec b/schroedinger.spec index a2b9f32..1d2f935 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -1,7 +1,7 @@ %define abi 1.0 Name: schroedinger -Version: 1.0.6 +Version: 1.0.7 Release: 1%{?dist} Summary: Portable libraries for the high quality Dirac video codec @@ -80,6 +80,9 @@ rm -rf %{buildroot} %{_libdir}/gstreamer-0.10/libgstschro.so %changelog +* Fri Apr 24 2009 Jeffrey C. Ollie - 1.0.7-1 +- Update to 1.0.7 + * Wed Feb 25 2009 Fedora Release Engineering - 1.0.5-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild diff --git a/sources b/sources index 397a029..fdc65d6 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -e5d0f34d623f6fc3bbf9468c48935c97 schroedinger-1.0.6.tar.gz +9a1132c54a58a6a040514f754b53ee44 schroedinger-1.0.7.tar.gz From 49463aa687d13c90114ec3048e67f07e753a4201 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 27 Jul 2009 03:53:09 +0000 Subject: [PATCH 15/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index 1d2f935..ae7d2b4 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.7 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -80,6 +80,9 @@ rm -rf %{buildroot} %{_libdir}/gstreamer-0.10/libgstschro.so %changelog +* Sun Jul 26 2009 Fedora Release Engineering - 1.0.7-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + * Fri Apr 24 2009 Jeffrey C. Ollie - 1.0.7-1 - Update to 1.0.7 From 22e632d86e4553c1fa14638c812e620db3b856dd Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Tue, 20 Oct 2009 22:44:36 +0000 Subject: [PATCH 16/57] Update to 1.0.8 --- .cvsignore | 2 +- schroedinger.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.cvsignore b/.cvsignore index cba2932..bbb34af 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -schroedinger-1.0.7.tar.gz +schroedinger-1.0.8.tar.gz diff --git a/schroedinger.spec b/schroedinger.spec index ae7d2b4..b2ca37c 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -1,8 +1,8 @@ %define abi 1.0 Name: schroedinger -Version: 1.0.7 -Release: 2%{?dist} +Version: 1.0.8 +Release: 1%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -80,6 +80,9 @@ rm -rf %{buildroot} %{_libdir}/gstreamer-0.10/libgstschro.so %changelog +* Tue Oct 20 2009 kwizart < kwizart at gmail.com > - 1.0.8-1 +- Update to 1.0.8 + * Sun Jul 26 2009 Fedora Release Engineering - 1.0.7-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild diff --git a/sources b/sources index fdc65d6..5bac1a8 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -9a1132c54a58a6a040514f754b53ee44 schroedinger-1.0.7.tar.gz +a76a7094f80419f81377b63432c64d01 schroedinger-1.0.8.tar.gz From df46e353f1b6a0fbdca12e9ef913ad6ea5049d14 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Tue, 20 Oct 2009 23:31:14 +0000 Subject: [PATCH 17/57] - Update to 1.0.8 - gstreamer-plugins-schroedinger is now in bad. --- schroedinger.spec | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/schroedinger.spec b/schroedinger.spec index b2ca37c..d4556cf 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.8 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -13,10 +13,14 @@ Source0: http://www.diracvideo.org/download/schroedinger/schroedinger-%{version} BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: liboil-devel >= 0.3.16 +BuildRequires: glew-devel >= 1.5.1 BuildRequires: gstreamer-devel >= 0.10 BuildRequires: gstreamer-plugins-base-devel >= 0.10 BuildRequires: gtk-doc +#Moved to -bad - need to be investigated. +Obsoletes: gstreamer-plugins-schroedinger < %{version} + %description The Schrödinger project will implement portable libraries for the high quality Dirac video codec created by BBC Research and @@ -37,12 +41,6 @@ Requires: liboil-devel >= 0.3.16 %description devel Development files for schroedinger -%package -n gstreamer-plugins-schroedinger -Group: Applications/Multimedia -Summary: GStreamer Plugins that implement Dirac video encoding and decoding - -%description -n gstreamer-plugins-schroedinger -GStreamer Plugins that implement Dirac video encoding and decoding %prep %setup -q @@ -75,13 +73,11 @@ rm -rf %{buildroot} %{_libdir}/*.so %{_libdir}/pkgconfig/schroedinger-%{abi}.pc -%files -n gstreamer-plugins-schroedinger -%defattr(-,root,root,-) -%{_libdir}/gstreamer-0.10/libgstschro.so %changelog -* Tue Oct 20 2009 kwizart < kwizart at gmail.com > - 1.0.8-1 +* Tue Oct 20 2009 kwizart < kwizart at gmail.com > - 1.0.8-2 - Update to 1.0.8 +- gstreamer-plugins-schroedinger is now in bad. * Sun Jul 26 2009 Fedora Release Engineering - 1.0.7-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild From b6a5f1139ba5a9d70a4f6d52d13ef2e1d926f64f Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Tue, 27 Oct 2009 23:24:09 +0000 Subject: [PATCH 18/57] - Re-introduce gstreamer sub-package until seen in -good --- import.log | 1 + 1 file changed, 1 insertion(+) create mode 100644 import.log diff --git a/import.log b/import.log new file mode 100644 index 0000000..4bdf783 --- /dev/null +++ b/import.log @@ -0,0 +1 @@ +schroedinger-1_0_8-3_fc11:HEAD:schroedinger-1.0.8-3.fc11.src.rpm:1256685452 From 92f8ba777333f691a1ab0f25c0b597ad092b7e17 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Tue, 27 Oct 2009 23:26:51 +0000 Subject: [PATCH 19/57] - Re-introduce gstreamer sub-package until seen in -good --- gst-plugins-schroedinger-1.0.8.patch | 6504 ++++++++++++++++++++++++++ gst-plugins-schroedinger-plug.patch | 74 + import.log | 1 + schroedinger.spec | 37 +- 4 files changed, 6611 insertions(+), 5 deletions(-) create mode 100644 gst-plugins-schroedinger-1.0.8.patch create mode 100644 gst-plugins-schroedinger-plug.patch diff --git a/gst-plugins-schroedinger-1.0.8.patch b/gst-plugins-schroedinger-1.0.8.patch new file mode 100644 index 0000000..1b31ede --- /dev/null +++ b/gst-plugins-schroedinger-1.0.8.patch @@ -0,0 +1,6504 @@ +diff -uNr schroedinger-1.0.8.orig/gst/gstschro.c schroedinger-1.0.8/gst/gstschro.c +--- schroedinger-1.0.8.orig/gst/gstschro.c 1970-01-01 01:00:00.000000000 +0100 ++++ schroedinger-1.0.8/gst/gstschro.c 2009-09-11 17:35:39.000000000 +0200 +@@ -0,0 +1,54 @@ ++/* GStreamer ++ * Copyright (C) 2005 David Schleef ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library 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. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include ++#include ++ ++GType gst_schro_enc_get_type (void); ++GType gst_schro_dec_get_type (void); ++GType gst_schro_parse_get_type (void); ++ ++GST_DEBUG_CATEGORY (schro_debug); ++#define GST_CAT_DEFAULT schro_debug ++ ++static gboolean ++plugin_init (GstPlugin * plugin) ++{ ++ schro_init (); ++ ++ GST_DEBUG_CATEGORY_INIT (schro_debug, "schro", 0, "Schroedinger"); ++ gst_element_register (plugin, "schrodec", GST_RANK_PRIMARY, ++ gst_schro_dec_get_type ()); ++ gst_element_register (plugin, "schroparse", GST_RANK_NONE, ++ gst_schro_parse_get_type ()); ++ gst_element_register (plugin, "schroenc", GST_RANK_PRIMARY, ++ gst_schro_enc_get_type ()); ++ ++ return TRUE; ++} ++ ++GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, ++ GST_VERSION_MINOR, ++ "schro", ++ "Schroedinger plugin", ++ plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) +diff -uNr schroedinger-1.0.8.orig/gst/gstschrodec.c schroedinger-1.0.8/gst/gstschrodec.c +--- schroedinger-1.0.8.orig/gst/gstschrodec.c 1970-01-01 01:00:00.000000000 +0100 ++++ schroedinger-1.0.8/gst/gstschrodec.c 2009-10-12 12:23:39.000000000 +0200 +@@ -0,0 +1,728 @@ ++/* Schrodinger ++ * Copyright (C) 2006 David Schleef ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library 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. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "gstschroutils.h" ++ ++#include ++ ++GST_DEBUG_CATEGORY_EXTERN (schro_debug); ++#define GST_CAT_DEFAULT schro_debug ++ ++#define GST_TYPE_SCHRO_DEC \ ++ (gst_schro_dec_get_type()) ++#define GST_SCHRO_DEC(obj) \ ++ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SCHRO_DEC,GstSchroDec)) ++#define GST_SCHRO_DEC_CLASS(klass) \ ++ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SCHRO_DEC,GstSchroDecClass)) ++#define GST_IS_SCHRO_DEC(obj) \ ++ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SCHRO_DEC)) ++#define GST_IS_SCHRO_DEC_CLASS(obj) \ ++ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SCHRO_DEC)) ++ ++typedef struct _GstSchroDec GstSchroDec; ++typedef struct _GstSchroDecClass GstSchroDecClass; ++ ++struct _GstSchroDec ++{ ++ GstBaseVideoDecoder base_video_decoder; ++ ++ SchroDecoder *decoder; ++ ++ GstBuffer *seq_header_buffer; ++}; ++ ++struct _GstSchroDecClass ++{ ++ GstBaseVideoDecoder base_video_decoder_class; ++}; ++ ++ ++/* GstSchroDec signals and args */ ++enum ++{ ++ LAST_SIGNAL ++}; ++ ++enum ++{ ++ ARG_0 ++}; ++ ++static void gst_schro_dec_finalize (GObject * object); ++static void gst_schro_dec_set_property (GObject * object, guint prop_id, ++ const GValue * value, GParamSpec * pspec); ++static void gst_schro_dec_get_property (GObject * object, guint prop_id, ++ GValue * value, GParamSpec * pspec); ++ ++static gboolean gst_schro_dec_sink_query (GstPad * pad, GstQuery * query); ++ ++static gboolean gst_schro_dec_start (GstBaseVideoDecoder * dec); ++static gboolean gst_schro_dec_stop (GstBaseVideoDecoder * dec); ++static gboolean gst_schro_dec_reset (GstBaseVideoDecoder * dec); ++static GstFlowReturn gst_schro_dec_parse_data (GstBaseVideoDecoder * ++ base_video_decoder, gboolean at_eos); ++static int gst_schro_dec_scan_for_sync (GstBaseVideoDecoder * ++ base_video_decoder, gboolean at_eos, int offset, int n); ++static GstFlowReturn gst_schro_dec_handle_frame (GstBaseVideoDecoder * decoder, ++ GstVideoFrame * frame); ++static GstFlowReturn gst_schro_dec_finish (GstBaseVideoDecoder * ++ base_video_decoder, GstVideoFrame * frame); ++static void gst_schrodec_send_tags (GstSchroDec * schro_dec); ++ ++static GstStaticPadTemplate gst_schro_dec_sink_template = ++GST_STATIC_PAD_TEMPLATE ("sink", ++ GST_PAD_SINK, ++ GST_PAD_ALWAYS, ++ GST_STATIC_CAPS ("video/x-dirac") ++ ); ++ ++static GstStaticPadTemplate gst_schro_dec_src_template = ++GST_STATIC_PAD_TEMPLATE ("src", ++ GST_PAD_SRC, ++ GST_PAD_ALWAYS, ++ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YUY2, AYUV }")) ++ ); ++ ++GST_BOILERPLATE (GstSchroDec, gst_schro_dec, GstBaseVideoDecoder, ++ GST_TYPE_BASE_VIDEO_DECODER); ++ ++static void ++gst_schro_dec_base_init (gpointer g_class) ++{ ++ static GstElementDetails compress_details = ++ GST_ELEMENT_DETAILS ("Dirac Decoder", ++ "Codec/Decoder/Video", ++ "Decode Dirac streams", ++ "David Schleef "); ++ GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); ++ ++ gst_element_class_add_pad_template (element_class, ++ gst_static_pad_template_get (&gst_schro_dec_src_template)); ++ gst_element_class_add_pad_template (element_class, ++ gst_static_pad_template_get (&gst_schro_dec_sink_template)); ++ ++ gst_element_class_set_details (element_class, &compress_details); ++} ++ ++static void ++gst_schro_dec_class_init (GstSchroDecClass * klass) ++{ ++ GObjectClass *gobject_class; ++ GstBaseVideoDecoderClass *base_video_decoder_class; ++ GstElementClass *element_class; ++ ++ gobject_class = G_OBJECT_CLASS (klass); ++ element_class = GST_ELEMENT_CLASS (klass); ++ base_video_decoder_class = GST_BASE_VIDEO_DECODER_CLASS (klass); ++ ++ gobject_class->set_property = gst_schro_dec_set_property; ++ gobject_class->get_property = gst_schro_dec_get_property; ++ gobject_class->finalize = gst_schro_dec_finalize; ++ ++ base_video_decoder_class->start = GST_DEBUG_FUNCPTR (gst_schro_dec_start); ++ base_video_decoder_class->stop = GST_DEBUG_FUNCPTR (gst_schro_dec_stop); ++ base_video_decoder_class->reset = GST_DEBUG_FUNCPTR (gst_schro_dec_reset); ++ base_video_decoder_class->parse_data = ++ GST_DEBUG_FUNCPTR (gst_schro_dec_parse_data); ++ base_video_decoder_class->scan_for_sync = ++ GST_DEBUG_FUNCPTR (gst_schro_dec_scan_for_sync); ++ base_video_decoder_class->handle_frame = ++ GST_DEBUG_FUNCPTR (gst_schro_dec_handle_frame); ++ base_video_decoder_class->finish = GST_DEBUG_FUNCPTR (gst_schro_dec_finish); ++} ++ ++static void ++gst_schro_dec_init (GstSchroDec * schro_dec, GstSchroDecClass * klass) ++{ ++ GST_DEBUG ("gst_schro_dec_init"); ++ ++ gst_pad_set_query_function (GST_BASE_VIDEO_CODEC_SINK_PAD (schro_dec), ++ gst_schro_dec_sink_query); ++ ++ schro_dec->decoder = schro_decoder_new (); ++} ++ ++#define OGG_DIRAC_GRANULE_SHIFT 22 ++#define OGG_DIRAC_GRANULE_LOW_MASK ((1ULL<> 22) + (granulepos & OGG_DIRAC_GRANULE_LOW_MASK)) >> 9; ++ dist_h = (granulepos >> 22) & 0xff; ++ dist_l = granulepos & 0xff; ++ dist = (dist_h << 8) | dist_l; ++ delay = (granulepos >> 9) & 0x1fff; ++ dt = pt - delay; ++ ++ return pt >> 1; ++} ++ ++static gboolean ++gst_schro_dec_sink_convert (GstPad * pad, ++ GstFormat src_format, gint64 src_value, ++ GstFormat * dest_format, gint64 * dest_value) ++{ ++ gboolean res = TRUE; ++ GstSchroDec *dec; ++ GstVideoState *state; ++ ++ if (src_format == *dest_format) { ++ *dest_value = src_value; ++ return TRUE; ++ } ++ ++ dec = GST_SCHRO_DEC (gst_pad_get_parent (pad)); ++ ++ /* FIXME: check if we are in a decoding state */ ++ ++ state = gst_base_video_decoder_get_state (GST_BASE_VIDEO_DECODER (dec)); ++ ++ res = FALSE; ++ if (src_format == GST_FORMAT_DEFAULT && *dest_format == GST_FORMAT_TIME) { ++ if (state->fps_d != 0) { ++ *dest_value = gst_util_uint64_scale (granulepos_to_frame (src_value), ++ state->fps_d * GST_SECOND, state->fps_n); ++ res = TRUE; ++ } else { ++ res = FALSE; ++ } ++ } ++ ++ gst_object_unref (dec); ++ ++ return res; ++} ++ ++static gboolean ++gst_schro_dec_sink_query (GstPad * pad, GstQuery * query) ++{ ++ GstSchroDec *dec; ++ gboolean res = FALSE; ++ ++ dec = GST_SCHRO_DEC (gst_pad_get_parent (pad)); ++ ++ switch (GST_QUERY_TYPE (query)) { ++ case GST_QUERY_CONVERT: ++ { ++ GstFormat src_fmt, dest_fmt; ++ gint64 src_val, dest_val; ++ ++ gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); ++ res = gst_schro_dec_sink_convert (pad, src_fmt, src_val, &dest_fmt, ++ &dest_val); ++ if (!res) ++ goto error; ++ gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); ++ break; ++ } ++ default: ++ res = gst_pad_query_default (pad, query); ++ break; ++ } ++done: ++ gst_object_unref (dec); ++ ++ return res; ++error: ++ GST_DEBUG_OBJECT (dec, "query failed"); ++ goto done; ++} ++ ++static gboolean ++gst_schro_dec_start (GstBaseVideoDecoder * dec) ++{ ++ if (dec->codec_data) { ++ GST_DEBUG_OBJECT (dec, "codec data!"); ++ } ++ ++ return TRUE; ++} ++ ++static gboolean ++gst_schro_dec_stop (GstBaseVideoDecoder * dec) ++{ ++ ++ return TRUE; ++} ++ ++static gboolean ++gst_schro_dec_reset (GstBaseVideoDecoder * dec) ++{ ++ GstSchroDec *schro_dec; ++ ++ schro_dec = GST_SCHRO_DEC (dec); ++ ++ GST_DEBUG ("reset"); ++ ++ if (schro_dec->decoder) { ++ schro_decoder_reset (schro_dec->decoder); ++ } ++ ++ return TRUE; ++} ++ ++static void ++gst_schro_dec_finalize (GObject * object) ++{ ++ GstSchroDec *schro_dec; ++ ++ g_return_if_fail (GST_IS_SCHRO_DEC (object)); ++ schro_dec = GST_SCHRO_DEC (object); ++ ++ if (schro_dec->decoder) { ++ schro_decoder_free (schro_dec->decoder); ++ schro_dec->decoder = NULL; ++ } ++ ++ G_OBJECT_CLASS (parent_class)->finalize (object); ++} ++ ++static void ++gst_schro_dec_set_property (GObject * object, guint prop_id, ++ const GValue * value, GParamSpec * pspec) ++{ ++ GstSchroDec *src; ++ ++ g_return_if_fail (GST_IS_SCHRO_DEC (object)); ++ src = GST_SCHRO_DEC (object); ++ ++ GST_DEBUG ("gst_schro_dec_set_property"); ++ switch (prop_id) { ++ default: ++ break; ++ } ++} ++ ++static void ++gst_schro_dec_get_property (GObject * object, guint prop_id, GValue * value, ++ GParamSpec * pspec) ++{ ++ GstSchroDec *src; ++ ++ g_return_if_fail (GST_IS_SCHRO_DEC (object)); ++ src = GST_SCHRO_DEC (object); ++ ++ switch (prop_id) { ++ default: ++ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); ++ break; ++ } ++} ++ ++static void ++parse_sequence_header (GstSchroDec * schro_dec, guint8 * data, int size) ++{ ++ SchroVideoFormat video_format; ++ int ret; ++ GstVideoState *state; ++ ++ GST_DEBUG_OBJECT (schro_dec, "parse_sequence_header size=%d", size); ++ ++ state = gst_base_video_decoder_get_state (GST_BASE_VIDEO_DECODER (schro_dec)); ++ ++ schro_dec->seq_header_buffer = gst_buffer_new_and_alloc (size); ++ memcpy (GST_BUFFER_DATA (schro_dec->seq_header_buffer), data, size); ++ ++ ret = schro_parse_decode_sequence_header (data + 13, size - 13, ++ &video_format); ++ if (ret) { ++ if (video_format.chroma_format == SCHRO_CHROMA_444) { ++ state->format = GST_VIDEO_FORMAT_AYUV; ++ } else if (video_format.chroma_format == SCHRO_CHROMA_422) { ++ state->format = GST_VIDEO_FORMAT_YUY2; ++ } else if (video_format.chroma_format == SCHRO_CHROMA_420) { ++ state->format = GST_VIDEO_FORMAT_I420; ++ } ++ state->fps_n = video_format.frame_rate_numerator; ++ state->fps_d = video_format.frame_rate_denominator; ++ GST_DEBUG_OBJECT (schro_dec, "Frame rate is %d/%d", state->fps_n, ++ state->fps_d); ++ ++ state->width = video_format.width; ++ state->height = video_format.height; ++ GST_DEBUG ("Frame dimensions are %d x %d\n", state->width, state->height); ++ ++ state->clean_width = video_format.clean_width; ++ state->clean_height = video_format.clean_height; ++ state->clean_offset_left = video_format.left_offset; ++ state->clean_offset_top = video_format.top_offset; ++ ++ state->par_n = video_format.aspect_ratio_numerator; ++ state->par_d = video_format.aspect_ratio_denominator; ++ GST_DEBUG ("Pixel aspect ratio is %d/%d", state->par_n, state->par_d); ++ ++ /* FIXME state points to what is actually in the decoder */ ++ //gst_base_video_decoder_set_state (GST_BASE_VIDEO_DECODER (schro_dec), ++ // state); ++ } else { ++ GST_WARNING ("Failed to get frame rate from sequence header"); ++ } ++ ++ gst_schrodec_send_tags (schro_dec); ++} ++ ++ ++static GstFlowReturn ++gst_schro_dec_parse_data (GstBaseVideoDecoder * base_video_decoder, ++ gboolean at_eos) ++{ ++ GstSchroDec *schro_decoder; ++ unsigned char header[SCHRO_PARSE_HEADER_SIZE]; ++ int next; ++ int prev; ++ int parse_code; ++ ++ GST_DEBUG_OBJECT (base_video_decoder, "parse_data"); ++ ++ schro_decoder = GST_SCHRO_DEC (base_video_decoder); ++ ++ if (gst_adapter_available (base_video_decoder->input_adapter) < ++ SCHRO_PARSE_HEADER_SIZE) { ++ return GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA; ++ } ++ ++ GST_DEBUG ("available %d", ++ gst_adapter_available (base_video_decoder->input_adapter)); ++ ++ gst_adapter_copy (base_video_decoder->input_adapter, header, 0, ++ SCHRO_PARSE_HEADER_SIZE); ++ ++ parse_code = header[4]; ++ next = GST_READ_UINT32_BE (header + 5); ++ prev = GST_READ_UINT32_BE (header + 9); ++ ++ GST_DEBUG ("%08x %02x %08x %08x", ++ GST_READ_UINT32_BE (header), parse_code, next, prev); ++ ++ if (memcmp (header, "BBCD", 4) != 0 || ++ (next & 0xf0000000) || (prev & 0xf0000000)) { ++ gst_base_video_decoder_lost_sync (base_video_decoder); ++ return GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA; ++ } ++ ++ if (SCHRO_PARSE_CODE_IS_END_OF_SEQUENCE (parse_code)) { ++ GstVideoFrame *frame; ++ ++ if (next != 0 && next != SCHRO_PARSE_HEADER_SIZE) { ++ GST_WARNING ("next is not 0 or 13 in EOS packet (%d)", next); ++ } ++ ++ gst_base_video_decoder_add_to_frame (base_video_decoder, ++ SCHRO_PARSE_HEADER_SIZE); ++ ++ frame = base_video_decoder->current_frame; ++ frame->is_eos = TRUE; ++ ++ SCHRO_DEBUG ("eos"); ++ ++ return gst_base_video_decoder_have_frame (base_video_decoder); ++ } ++ ++ if (gst_adapter_available (base_video_decoder->input_adapter) < next) { ++ return GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA; ++ } ++ ++ if (SCHRO_PARSE_CODE_IS_SEQ_HEADER (parse_code)) { ++ guint8 *data; ++ ++ data = g_malloc (next); ++ ++ gst_adapter_copy (base_video_decoder->input_adapter, data, 0, next); ++ parse_sequence_header (schro_decoder, data, next); ++ ++ gst_base_video_decoder_set_sync_point (base_video_decoder); ++ ++ if (GST_CLOCK_TIME_IS_VALID (base_video_decoder->last_sink_timestamp)) { ++ base_video_decoder->current_frame->presentation_timestamp = ++ base_video_decoder->last_sink_timestamp; ++ GST_DEBUG ("got timestamp %" G_GINT64_FORMAT, ++ base_video_decoder->last_sink_timestamp); ++ } else if (base_video_decoder->last_sink_offset_end != -1) { ++ GstVideoState *state; ++ ++#if 0 ++ /* FIXME perhaps should use this to determine if the granulepos ++ * is valid */ ++ { ++ guint64 pt; ++ int dist_h; ++ int dist_l; ++ int dist; ++ int delay; ++ guint64 dt; ++ gint64 granulepos = base_video_decoder->last_sink_offset_end; ++ ++ pt = ((granulepos >> 22) + ++ (granulepos & OGG_DIRAC_GRANULE_LOW_MASK)) >> 9; ++ dist_h = (granulepos >> 22) & 0xff; ++ dist_l = granulepos & 0xff; ++ dist = (dist_h << 8) | dist_l; ++ delay = (granulepos >> 9) & 0x1fff; ++ dt = pt - delay; ++ GST_DEBUG ("gp pt %lld dist %d delay %d dt %lld", pt, dist, delay, dt); ++ } ++#endif ++ state = ++ gst_base_video_decoder_get_state (GST_BASE_VIDEO_DECODER ++ (schro_decoder)); ++ base_video_decoder->current_frame->presentation_timestamp = ++ gst_util_uint64_scale (granulepos_to_frame ++ (base_video_decoder->last_sink_offset_end), state->fps_d * GST_SECOND, ++ state->fps_n); ++ } else { ++ base_video_decoder->current_frame->presentation_timestamp = -1; ++ } ++ ++ g_free (data); ++ } ++ ++ if (schro_decoder->seq_header_buffer == NULL) { ++ gst_adapter_flush (base_video_decoder->input_adapter, next); ++ return GST_FLOW_OK; ++ } ++ ++ if (SCHRO_PARSE_CODE_IS_PICTURE (parse_code)) { ++ GstVideoFrame *frame; ++ guint8 tmp[4]; ++ ++ frame = base_video_decoder->current_frame; ++ ++ gst_adapter_copy (base_video_decoder->input_adapter, tmp, ++ SCHRO_PARSE_HEADER_SIZE, 4); ++ ++ frame->presentation_frame_number = GST_READ_UINT32_BE (tmp); ++ ++ gst_base_video_decoder_add_to_frame (base_video_decoder, next); ++ ++ return gst_base_video_decoder_have_frame (base_video_decoder); ++ } else { ++ gst_base_video_decoder_add_to_frame (base_video_decoder, next); ++ } ++ ++ return GST_FLOW_OK; ++} ++ ++static int ++gst_schro_dec_scan_for_sync (GstBaseVideoDecoder * base_video_decoder, ++ gboolean at_eos, int offset, int n) ++{ ++ GstAdapter *adapter = base_video_decoder->input_adapter; ++ int n_available; ++ int ret; ++ ++ n_available = gst_adapter_available (adapter) - offset; ++ ++ if (n_available < 4) { ++ if (at_eos) { ++ return n_available; ++ } else { ++ return 0; ++ } ++ } ++ ++ n = MIN (n, n_available - 3); ++ ++ ret = gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x42424344, ++ offset, n); ++ if (ret == -1) { ++ return n; ++ } ++ return ret; ++} ++ ++ ++static void ++gst_schrodec_send_tags (GstSchroDec * schro_dec) ++{ ++ GstTagList *list; ++ ++ list = gst_tag_list_new (); ++ gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, ++ GST_TAG_VIDEO_CODEC, "Dirac", NULL); ++ ++ gst_element_found_tags_for_pad (GST_ELEMENT_CAST (schro_dec), ++ GST_BASE_VIDEO_CODEC_SRC_PAD (schro_dec), list); ++} ++ ++static GstFlowReturn ++gst_schro_dec_process (GstSchroDec * schro_dec, gboolean eos) ++{ ++ gboolean go; ++ GstFlowReturn ret; ++ ++ ret = GST_FLOW_OK; ++ go = TRUE; ++ while (go) { ++ int it; ++ ++ it = schro_decoder_autoparse_wait (schro_dec->decoder); ++ ++ switch (it) { ++ case SCHRO_DECODER_FIRST_ACCESS_UNIT: ++ break; ++ case SCHRO_DECODER_NEED_BITS: ++ GST_DEBUG ("need bits"); ++ go = 0; ++ break; ++ case SCHRO_DECODER_NEED_FRAME: ++ { ++ GstBuffer *outbuf; ++ GstVideoState *state; ++ SchroFrame *schro_frame; ++ GstFlowReturn flow_ret; ++ int size; ++ ++ GST_DEBUG ("need frame"); ++ ++ state = ++ gst_base_video_decoder_get_state (GST_BASE_VIDEO_DECODER ++ (schro_dec)); ++ size = ++ gst_video_format_get_size (state->format, state->width, ++ state->height); ++ flow_ret = ++ gst_pad_alloc_buffer_and_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD ++ (schro_dec), GST_BUFFER_OFFSET_NONE, size, ++ GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (schro_dec)), &outbuf); ++ if (flow_ret != GST_FLOW_OK) { ++ go = FALSE; ++ ret = flow_ret; ++ break; ++ } ++ schro_frame = gst_schro_buffer_wrap (outbuf, ++ state->format, state->width, state->height); ++ schro_decoder_add_output_picture (schro_dec->decoder, schro_frame); ++ break; ++ } ++ case SCHRO_DECODER_OK: ++ { ++ SchroFrame *schro_frame; ++ SchroTag *tag; ++ GstVideoFrame *frame; ++ ++ GST_DEBUG ("got frame"); ++ ++ tag = schro_decoder_get_picture_tag (schro_dec->decoder); ++ schro_frame = schro_decoder_pull (schro_dec->decoder); ++ frame = tag->value; ++ ++ if (schro_frame) { ++ if (schro_frame->priv) { ++ GstFlowReturn flow_ret; ++ ++ frame->src_buffer = gst_buffer_ref (GST_BUFFER (schro_frame->priv)); ++ ++ flow_ret = ++ gst_base_video_decoder_finish_frame (GST_BASE_VIDEO_DECODER ++ (schro_dec), frame); ++ if (flow_ret != GST_FLOW_OK) { ++ GST_DEBUG ("finish frame returned %d", flow_ret); ++ return flow_ret; ++ } ++ } else { ++ GST_DEBUG ("skipped frame"); ++ } ++ ++ schro_frame_unref (schro_frame); ++ } ++ if (!eos) { ++ go = FALSE; ++ } ++ } ++ ++ break; ++ case SCHRO_DECODER_EOS: ++ GST_DEBUG ("eos"); ++ go = FALSE; ++ break; ++ case SCHRO_DECODER_ERROR: ++ go = FALSE; ++ GST_DEBUG ("codec error"); ++ ret = GST_FLOW_ERROR; ++ break; ++ } ++ } ++ return ret; ++} ++ ++GstFlowReturn ++gst_schro_dec_handle_frame (GstBaseVideoDecoder * base_video_decoder, ++ GstVideoFrame * frame) ++{ ++ GstSchroDec *schro_dec; ++ int schro_ret; ++ SchroBuffer *input_buffer; ++ GstVideoState *state; ++ ++ schro_dec = GST_SCHRO_DEC (base_video_decoder); ++ ++ GST_DEBUG ("handle frame"); ++ ++ state = gst_base_video_decoder_get_state (base_video_decoder); ++ ++ gst_base_video_decoder_set_src_caps (base_video_decoder); ++ ++ input_buffer = gst_schro_wrap_gst_buffer (frame->sink_buffer); ++ frame->sink_buffer = NULL; ++ ++ input_buffer->tag = schro_tag_new (frame, NULL); ++ ++ schro_ret = schro_decoder_autoparse_push (schro_dec->decoder, input_buffer); ++ ++ return gst_schro_dec_process (schro_dec, FALSE); ++} ++ ++GstFlowReturn ++gst_schro_dec_finish (GstBaseVideoDecoder * base_video_decoder, ++ GstVideoFrame * frame) ++{ ++ GstSchroDec *schro_dec; ++ ++ schro_dec = GST_SCHRO_DEC (base_video_decoder); ++ ++ GST_DEBUG ("finish"); ++ ++ gst_base_video_decoder_set_src_caps (base_video_decoder); ++ ++ schro_decoder_autoparse_push_end_of_sequence (schro_dec->decoder); ++ ++ return gst_schro_dec_process (schro_dec, TRUE); ++} +diff -uNr schroedinger-1.0.8.orig/gst/gstschroenc.c schroedinger-1.0.8/gst/gstschroenc.c +--- schroedinger-1.0.8.orig/gst/gstschroenc.c 1970-01-01 01:00:00.000000000 +0100 ++++ schroedinger-1.0.8/gst/gstschroenc.c 2009-10-23 22:02:51.000000000 +0200 +@@ -0,0 +1,791 @@ ++/* Schrodinger ++ * Copyright (C) 2006 David Schleef ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library 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. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include "gstschroutils.h" ++ ++GST_DEBUG_CATEGORY_EXTERN (schro_debug); ++#define GST_CAT_DEFAULT schro_debug ++ ++#define GST_TYPE_SCHRO_ENC \ ++ (gst_schro_enc_get_type()) ++#define GST_SCHRO_ENC(obj) \ ++ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SCHRO_ENC,GstSchroEnc)) ++#define GST_SCHRO_ENC_CLASS(klass) \ ++ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SCHRO_ENC,GstSchroEncClass)) ++#define GST_IS_SCHRO_ENC(obj) \ ++ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SCHRO_ENC)) ++#define GST_IS_SCHRO_ENC_CLASS(obj) \ ++ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SCHRO_ENC)) ++ ++typedef struct _GstSchroEnc GstSchroEnc; ++typedef struct _GstSchroEncClass GstSchroEncClass; ++ ++typedef enum ++{ ++ GST_SCHRO_ENC_OUTPUT_OGG, ++ GST_SCHRO_ENC_OUTPUT_QUICKTIME, ++ GST_SCHRO_ENC_OUTPUT_AVI, ++ GST_SCHRO_ENC_OUTPUT_MPEG_TS, ++ GST_SCHRO_ENC_OUTPUT_MP4 ++} GstSchroEncOutputType; ++ ++struct _GstSchroEnc ++{ ++ GstBaseVideoEncoder base_encoder; ++ ++ GstPad *sinkpad; ++ GstPad *srcpad; ++ ++ /* video properties */ ++ GstSchroEncOutputType output_format; ++ ++ /* state */ ++ SchroEncoder *encoder; ++ SchroVideoFormat *video_format; ++ GstVideoFrame *eos_frame; ++ GstBuffer *seq_header_buffer; ++ ++ guint64 last_granulepos; ++ guint64 granule_offset; ++}; ++ ++struct _GstSchroEncClass ++{ ++ GstBaseVideoEncoderClass parent_class; ++}; ++ ++ ++ ++enum ++{ ++ LAST_SIGNAL ++}; ++ ++enum ++{ ++ ARG_0 ++}; ++ ++static void gst_schro_enc_set_property (GObject * object, guint prop_id, ++ const GValue * value, GParamSpec * pspec); ++static void gst_schro_enc_get_property (GObject * object, guint prop_id, ++ GValue * value, GParamSpec * pspec); ++ ++static GstFlowReturn gst_schro_enc_process (GstSchroEnc * schro_enc); ++ ++static gboolean gst_schro_enc_set_format (GstBaseVideoEncoder * ++ base_video_encoder, GstVideoState * state); ++static gboolean gst_schro_enc_start (GstBaseVideoEncoder * base_video_encoder); ++static gboolean gst_schro_enc_stop (GstBaseVideoEncoder * base_video_encoder); ++static gboolean gst_schro_enc_finish (GstBaseVideoEncoder * base_video_encoder, ++ GstVideoFrame * frame); ++static GstFlowReturn gst_schro_enc_handle_frame (GstBaseVideoEncoder * ++ base_video_encoder, GstVideoFrame * frame); ++static GstFlowReturn gst_schro_enc_shape_output (GstBaseVideoEncoder * ++ base_video_encoder, GstVideoFrame * frame); ++static GstCaps *gst_schro_enc_get_caps (GstBaseVideoEncoder * ++ base_video_encoder); ++ ++static GstStaticPadTemplate gst_schro_enc_sink_template = ++GST_STATIC_PAD_TEMPLATE ("sink", ++ GST_PAD_SINK, ++ GST_PAD_ALWAYS, ++ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YV12, YUY2, UYVY, AYUV }")) ++ ); ++ ++static GstStaticPadTemplate gst_schro_enc_src_template = ++ GST_STATIC_PAD_TEMPLATE ("src", ++ GST_PAD_SRC, ++ GST_PAD_ALWAYS, ++ GST_STATIC_CAPS ("video/x-dirac;video/x-qt-part;video/x-mp4-part") ++ ); ++ ++GST_BOILERPLATE (GstSchroEnc, gst_schro_enc, GstBaseVideoEncoder, ++ GST_TYPE_BASE_VIDEO_ENCODER); ++ ++static void ++gst_schro_enc_base_init (gpointer g_class) ++{ ++ static GstElementDetails schro_enc_details = ++ GST_ELEMENT_DETAILS ("Dirac Encoder", ++ "Codec/Encoder/Video", ++ "Encode raw video into Dirac stream", ++ "David Schleef "); ++ GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); ++ ++ gst_element_class_add_pad_template (element_class, ++ gst_static_pad_template_get (&gst_schro_enc_src_template)); ++ gst_element_class_add_pad_template (element_class, ++ gst_static_pad_template_get (&gst_schro_enc_sink_template)); ++ ++ gst_element_class_set_details (element_class, &schro_enc_details); ++} ++ ++static GType ++register_enum_list (const SchroEncoderSetting * setting) ++{ ++ GType type; ++ static GEnumValue *enumtypes; ++ int n; ++ char *typename; ++ int i; ++ ++ n = setting->max + 1; ++ ++ enumtypes = g_malloc0 ((n + 1) * sizeof (GEnumValue)); ++ for (i = 0; i < n; i++) { ++ enumtypes[i].value = i; ++ enumtypes[i].value_name = setting->enum_list[i]; ++ enumtypes[i].value_nick = setting->enum_list[i]; ++ } ++ ++ typename = g_strdup_printf ("SchroEncoderSettingEnum_%s", setting->name); ++ type = g_enum_register_static (typename, enumtypes); ++ g_free (typename); ++ ++ return type; ++} ++ ++static void ++gst_schro_enc_class_init (GstSchroEncClass * klass) ++{ ++ GObjectClass *gobject_class; ++ GstElementClass *gstelement_class; ++ GstBaseVideoEncoderClass *basevideocoder_class; ++ int i; ++ ++ gobject_class = G_OBJECT_CLASS (klass); ++ gstelement_class = GST_ELEMENT_CLASS (klass); ++ basevideocoder_class = GST_BASE_VIDEO_ENCODER_CLASS (klass); ++ ++ gobject_class->set_property = gst_schro_enc_set_property; ++ gobject_class->get_property = gst_schro_enc_get_property; ++ ++ for (i = 0; i < schro_encoder_get_n_settings (); i++) { ++ const SchroEncoderSetting *setting; ++ ++ setting = schro_encoder_get_setting_info (i); ++ ++ switch (setting->type) { ++ case SCHRO_ENCODER_SETTING_TYPE_BOOLEAN: ++ g_object_class_install_property (gobject_class, i + 1, ++ g_param_spec_boolean (setting->name, setting->name, setting->name, ++ setting->default_value, G_PARAM_READWRITE)); ++ break; ++ case SCHRO_ENCODER_SETTING_TYPE_INT: ++ g_object_class_install_property (gobject_class, i + 1, ++ g_param_spec_int (setting->name, setting->name, setting->name, ++ setting->min, setting->max, setting->default_value, ++ G_PARAM_READWRITE)); ++ break; ++ case SCHRO_ENCODER_SETTING_TYPE_ENUM: ++ g_object_class_install_property (gobject_class, i + 1, ++ g_param_spec_enum (setting->name, setting->name, setting->name, ++ register_enum_list (setting), setting->default_value, ++ G_PARAM_READWRITE)); ++ break; ++ case SCHRO_ENCODER_SETTING_TYPE_DOUBLE: ++ g_object_class_install_property (gobject_class, i + 1, ++ g_param_spec_double (setting->name, setting->name, setting->name, ++ setting->min, setting->max, setting->default_value, ++ G_PARAM_READWRITE)); ++ break; ++ default: ++ break; ++ } ++ } ++ ++ basevideocoder_class->set_format = ++ GST_DEBUG_FUNCPTR (gst_schro_enc_set_format); ++ basevideocoder_class->start = GST_DEBUG_FUNCPTR (gst_schro_enc_start); ++ basevideocoder_class->stop = GST_DEBUG_FUNCPTR (gst_schro_enc_stop); ++ basevideocoder_class->finish = GST_DEBUG_FUNCPTR (gst_schro_enc_finish); ++ basevideocoder_class->handle_frame = ++ GST_DEBUG_FUNCPTR (gst_schro_enc_handle_frame); ++ basevideocoder_class->shape_output = ++ GST_DEBUG_FUNCPTR (gst_schro_enc_shape_output); ++ basevideocoder_class->get_caps = GST_DEBUG_FUNCPTR (gst_schro_enc_get_caps); ++} ++ ++static void ++gst_schro_enc_init (GstSchroEnc * schro_enc, GstSchroEncClass * klass) ++{ ++ GST_DEBUG ("gst_schro_enc_init"); ++ ++ /* Normally, we'd create the encoder in ->start(), but we use the ++ * encoder to store object properties. So it needs to be created ++ * here. */ ++ schro_enc->encoder = schro_encoder_new (); ++ schro_encoder_set_packet_assembly (schro_enc->encoder, TRUE); ++ schro_enc->video_format = schro_encoder_get_video_format (schro_enc->encoder); ++} ++ ++ ++ ++static gboolean ++gst_schro_enc_set_format (GstBaseVideoEncoder * base_video_encoder, ++ GstVideoState * state) ++{ ++ GstCaps *caps; ++ GstStructure *structure; ++ GstSchroEnc *schro_enc = GST_SCHRO_ENC (base_video_encoder); ++ ++ GST_DEBUG ("set_output_caps"); ++ caps = ++ gst_pad_get_allowed_caps (GST_BASE_VIDEO_CODEC_SRC_PAD ++ (base_video_encoder)); ++ if (caps == NULL) { ++ caps = ++ gst_caps_copy (gst_pad_get_pad_template_caps ++ (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder))); ++ } ++ ++ if (gst_caps_is_empty (caps)) { ++ gst_caps_unref (caps); ++ return FALSE; ++ } ++ ++ structure = gst_caps_get_structure (caps, 0); ++ ++ if (gst_structure_has_name (structure, "video/x-dirac")) { ++ schro_enc->output_format = GST_SCHRO_ENC_OUTPUT_OGG; ++ } else if (gst_structure_has_name (structure, "video/x-qt-part")) { ++ schro_enc->output_format = GST_SCHRO_ENC_OUTPUT_QUICKTIME; ++ } else if (gst_structure_has_name (structure, "video/x-avi-part")) { ++ schro_enc->output_format = GST_SCHRO_ENC_OUTPUT_AVI; ++ } else if (gst_structure_has_name (structure, "video/x-mp4-part")) { ++ schro_enc->output_format = GST_SCHRO_ENC_OUTPUT_MP4; ++ } else { ++ gst_caps_unref (caps); ++ return FALSE; ++ } ++ ++ gst_caps_unref (caps); ++ ++ gst_base_video_encoder_set_latency_fields (base_video_encoder, ++ 2 * (int) schro_encoder_setting_get_double (schro_enc->encoder, ++ "queue_depth")); ++ ++ schro_video_format_set_std_video_format (schro_enc->video_format, ++ SCHRO_VIDEO_FORMAT_CUSTOM); ++ ++ switch (state->format) { ++ case GST_VIDEO_FORMAT_I420: ++ case GST_VIDEO_FORMAT_YV12: ++ schro_enc->video_format->chroma_format = SCHRO_CHROMA_420; ++ break; ++ case GST_VIDEO_FORMAT_YUY2: ++ case GST_VIDEO_FORMAT_UYVY: ++ schro_enc->video_format->chroma_format = SCHRO_CHROMA_422; ++ break; ++ case GST_VIDEO_FORMAT_AYUV: ++ schro_enc->video_format->chroma_format = SCHRO_CHROMA_444; ++ break; ++ case GST_VIDEO_FORMAT_ARGB: ++ schro_enc->video_format->chroma_format = SCHRO_CHROMA_420; ++ break; ++ default: ++ g_assert_not_reached (); ++ } ++ ++ schro_enc->video_format->frame_rate_numerator = state->fps_n; ++ schro_enc->video_format->frame_rate_denominator = state->fps_d; ++ ++ schro_enc->video_format->width = state->width; ++ schro_enc->video_format->height = state->height; ++ schro_enc->video_format->clean_width = state->clean_width; ++ schro_enc->video_format->clean_height = state->clean_height; ++ schro_enc->video_format->left_offset = state->clean_offset_left; ++ schro_enc->video_format->top_offset = state->clean_offset_top; ++ ++ schro_enc->video_format->aspect_ratio_numerator = state->par_n; ++ schro_enc->video_format->aspect_ratio_denominator = state->par_d; ++ ++ schro_video_format_set_std_signal_range (schro_enc->video_format, ++ SCHRO_SIGNAL_RANGE_8BIT_VIDEO); ++ schro_video_format_set_std_colour_spec (schro_enc->video_format, ++ SCHRO_COLOUR_SPEC_HDTV); ++ ++ schro_encoder_set_video_format (schro_enc->encoder, schro_enc->video_format); ++ schro_encoder_start (schro_enc->encoder); ++ ++ schro_enc->seq_header_buffer = ++ gst_schro_wrap_schro_buffer (schro_encoder_encode_sequence_header ++ (schro_enc->encoder)); ++ ++ return TRUE; ++} ++ ++static void ++gst_schro_enc_set_property (GObject * object, guint prop_id, ++ const GValue * value, GParamSpec * pspec) ++{ ++ GstSchroEnc *src; ++ ++ g_return_if_fail (GST_IS_SCHRO_ENC (object)); ++ src = GST_SCHRO_ENC (object); ++ ++ GST_DEBUG ("gst_schro_enc_set_property"); ++ ++ if (prop_id >= 1) { ++ const SchroEncoderSetting *setting; ++ setting = schro_encoder_get_setting_info (prop_id - 1); ++ switch (G_VALUE_TYPE (value)) { ++ case G_TYPE_DOUBLE: ++ schro_encoder_setting_set_double (src->encoder, setting->name, ++ g_value_get_double (value)); ++ break; ++ case G_TYPE_INT: ++ schro_encoder_setting_set_double (src->encoder, setting->name, ++ g_value_get_int (value)); ++ break; ++ case G_TYPE_BOOLEAN: ++ schro_encoder_setting_set_double (src->encoder, setting->name, ++ g_value_get_boolean (value)); ++ break; ++ default: ++ schro_encoder_setting_set_double (src->encoder, setting->name, ++ g_value_get_enum (value)); ++ break; ++ } ++ } ++} ++ ++static void ++gst_schro_enc_get_property (GObject * object, guint prop_id, GValue * value, ++ GParamSpec * pspec) ++{ ++ GstSchroEnc *src; ++ ++ g_return_if_fail (GST_IS_SCHRO_ENC (object)); ++ src = GST_SCHRO_ENC (object); ++ ++ if (prop_id >= 1) { ++ const SchroEncoderSetting *setting; ++ setting = schro_encoder_get_setting_info (prop_id - 1); ++ switch (G_VALUE_TYPE (value)) { ++ case G_TYPE_DOUBLE: ++ g_value_set_double (value, ++ schro_encoder_setting_get_double (src->encoder, setting->name)); ++ break; ++ case G_TYPE_INT: ++ g_value_set_int (value, ++ schro_encoder_setting_get_double (src->encoder, setting->name)); ++ break; ++ case G_TYPE_BOOLEAN: ++ g_value_set_boolean (value, ++ schro_encoder_setting_get_double (src->encoder, setting->name)); ++ break; ++ default: ++ /* it's an enum */ ++ g_value_set_enum (value, ++ schro_encoder_setting_get_double (src->encoder, setting->name)); ++ break; ++ } ++ } ++} ++ ++static gboolean ++gst_schro_enc_start (GstBaseVideoEncoder * base_video_encoder) ++{ ++ GstSchroEnc *schro_enc = GST_SCHRO_ENC (base_video_encoder); ++ ++ schro_enc->granule_offset = ~0; ++ ++ return TRUE; ++} ++ ++static gboolean ++gst_schro_enc_stop (GstBaseVideoEncoder * base_video_encoder) ++{ ++ GstSchroEnc *schro_enc = GST_SCHRO_ENC (base_video_encoder); ++ ++ if (schro_enc->encoder) { ++ schro_encoder_free (schro_enc->encoder); ++ schro_enc->encoder = NULL; ++ } ++ ++ return TRUE; ++} ++ ++static gboolean ++gst_schro_enc_finish (GstBaseVideoEncoder * base_video_encoder, ++ GstVideoFrame * frame) ++{ ++ GstSchroEnc *schro_enc = GST_SCHRO_ENC (base_video_encoder); ++ ++ GST_DEBUG ("finish"); ++ ++ schro_enc->eos_frame = frame; ++ ++ schro_encoder_end_of_stream (schro_enc->encoder); ++ gst_schro_enc_process (schro_enc); ++ ++ return TRUE; ++} ++ ++static GstFlowReturn ++gst_schro_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder, ++ GstVideoFrame * frame) ++{ ++ GstSchroEnc *schro_enc = GST_SCHRO_ENC (base_video_encoder); ++ SchroFrame *schro_frame; ++ GstFlowReturn ret; ++ const GstVideoState *state; ++ ++ state = gst_base_video_encoder_get_state (base_video_encoder); ++ ++ if (schro_enc->granule_offset == ~0LL) { ++ schro_enc->granule_offset = ++ gst_util_uint64_scale (frame->presentation_timestamp, ++ 2 * state->fps_n, GST_SECOND * state->fps_d); ++ GST_DEBUG ("granule offset %" G_GINT64_FORMAT, schro_enc->granule_offset); ++ } ++ ++ schro_frame = gst_schro_buffer_wrap (gst_buffer_ref (frame->sink_buffer), ++ state->format, state->width, state->height); ++ ++ GST_DEBUG ("pushing frame %p", frame); ++ schro_encoder_push_frame_full (schro_enc->encoder, schro_frame, frame); ++ ++ ret = gst_schro_enc_process (schro_enc); ++ ++ return ret; ++} ++ ++#if 0 ++static void ++gst_caps_add_streamheader (GstCaps * caps, GList * list) ++{ ++ GValue array = { 0 }; ++ GValue value = { 0 }; ++ GstBuffer *buf; ++ GList *g; ++ ++ g_value_init (&array, GST_TYPE_ARRAY); ++ ++ for (g = g_list_first (list); g; g = g_list_next (list)) { ++ g_value_init (&value, GST_TYPE_BUFFER); ++ buf = gst_buffer_copy (GST_BUFFER (g->data)); ++ gst_value_set_buffer (&value, buf); ++ gst_buffer_unref (buf); ++ gst_value_array_append_value (&array, &value); ++ g_value_unset (&value); ++ } ++ gst_structure_set_value (gst_caps_get_structure (caps, 0), ++ "streamheader", &array); ++ g_value_unset (&array); ++} ++#endif ++ ++static GstCaps * ++gst_schro_enc_get_caps (GstBaseVideoEncoder * base_video_encoder) ++{ ++ GstCaps *caps; ++ const GstVideoState *state; ++ GstSchroEnc *schro_enc; ++ ++ schro_enc = GST_SCHRO_ENC (base_video_encoder); ++ ++ state = gst_base_video_encoder_get_state (base_video_encoder); ++ ++ if (schro_enc->output_format == GST_SCHRO_ENC_OUTPUT_OGG) { ++ caps = gst_caps_new_simple ("video/x-dirac", ++ "width", G_TYPE_INT, state->width, ++ "height", G_TYPE_INT, state->height, ++ "framerate", GST_TYPE_FRACTION, state->fps_n, ++ state->fps_d, ++ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, ++ state->par_d, NULL); ++ ++ GST_BUFFER_FLAG_SET (schro_enc->seq_header_buffer, GST_BUFFER_FLAG_IN_CAPS); ++ ++ { ++ GValue array = { 0 }; ++ GValue value = { 0 }; ++ GstBuffer *buf; ++ int size; ++ ++ g_value_init (&array, GST_TYPE_ARRAY); ++ g_value_init (&value, GST_TYPE_BUFFER); ++ size = GST_BUFFER_SIZE (schro_enc->seq_header_buffer); ++ buf = gst_buffer_new_and_alloc (size + SCHRO_PARSE_HEADER_SIZE); ++ ++ /* ogg(mux) expects the header buffers to have 0 timestamps - ++ set OFFSET and OFFSET_END accordingly */ ++ GST_BUFFER_OFFSET (buf) = 0; ++ GST_BUFFER_OFFSET_END (buf) = 0; ++ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS); ++ ++ memcpy (GST_BUFFER_DATA (buf), ++ GST_BUFFER_DATA (schro_enc->seq_header_buffer), size); ++ GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf) + size + 0, 0x42424344); ++ GST_WRITE_UINT8 (GST_BUFFER_DATA (buf) + size + 4, ++ SCHRO_PARSE_CODE_END_OF_SEQUENCE); ++ GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf) + size + 5, 0); ++ GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf) + size + 9, size); ++ gst_value_set_buffer (&value, buf); ++ gst_buffer_unref (buf); ++ gst_value_array_append_value (&array, &value); ++ gst_structure_set_value (gst_caps_get_structure (caps, 0), ++ "streamheader", &array); ++ g_value_unset (&value); ++ g_value_unset (&array); ++ } ++ } else if (schro_enc->output_format == GST_SCHRO_ENC_OUTPUT_QUICKTIME) { ++ caps = gst_caps_new_simple ("video/x-qt-part", ++ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'), ++ "width", G_TYPE_INT, state->width, ++ "height", G_TYPE_INT, state->height, ++ "framerate", GST_TYPE_FRACTION, state->fps_n, ++ state->fps_d, ++ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, ++ state->par_d, NULL); ++ } else if (schro_enc->output_format == GST_SCHRO_ENC_OUTPUT_AVI) { ++ caps = gst_caps_new_simple ("video/x-avi-part", ++ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'), ++ "width", G_TYPE_INT, state->width, ++ "height", G_TYPE_INT, state->height, ++ "framerate", GST_TYPE_FRACTION, state->fps_n, ++ state->fps_d, ++ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, ++ state->par_d, NULL); ++ } else if (schro_enc->output_format == GST_SCHRO_ENC_OUTPUT_MPEG_TS) { ++ caps = gst_caps_new_simple ("video/x-mpegts-part", ++ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'), ++ "width", G_TYPE_INT, state->width, ++ "height", G_TYPE_INT, state->height, ++ "framerate", GST_TYPE_FRACTION, state->fps_n, ++ state->fps_d, ++ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, ++ state->par_d, NULL); ++ } else if (schro_enc->output_format == GST_SCHRO_ENC_OUTPUT_MP4) { ++ caps = gst_caps_new_simple ("video/x-mp4-part", ++ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'), ++ "width", G_TYPE_INT, state->width, ++ "height", G_TYPE_INT, state->height, ++ "framerate", GST_TYPE_FRACTION, state->fps_n, ++ state->fps_d, ++ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, ++ state->par_d, NULL); ++ } else { ++ g_assert_not_reached (); ++ } ++ ++ return caps; ++} ++ ++ ++ ++ ++static GstFlowReturn ++gst_schro_enc_shape_output_ogg (GstBaseVideoEncoder * base_video_encoder, ++ GstVideoFrame * frame) ++{ ++ GstSchroEnc *schro_enc; ++ int dpn; ++ int delay; ++ int dist; ++ int pt; ++ int dt; ++ guint64 granulepos_hi; ++ guint64 granulepos_low; ++ GstBuffer *buf = frame->src_buffer; ++ ++ schro_enc = GST_SCHRO_ENC (base_video_encoder); ++ ++ dpn = frame->decode_frame_number; ++ ++ pt = frame->presentation_frame_number * 2 + schro_enc->granule_offset; ++ dt = frame->decode_frame_number * 2 + schro_enc->granule_offset; ++ delay = pt - dt; ++ dist = frame->distance_from_sync; ++ ++ GST_DEBUG ("sys %d dpn %d pt %d dt %d delay %d dist %d", ++ (int) frame->system_frame_number, ++ (int) frame->decode_frame_number, pt, dt, delay, dist); ++ ++ granulepos_hi = (((guint64) pt - delay) << 9) | ((dist >> 8)); ++ granulepos_low = (delay << 9) | (dist & 0xff); ++ GST_DEBUG ("granulepos %" G_GINT64_FORMAT ":%" G_GINT64_FORMAT, granulepos_hi, ++ granulepos_low); ++ ++ if (frame->is_eos) { ++ GST_BUFFER_OFFSET_END (buf) = schro_enc->last_granulepos; ++ } else { ++ schro_enc->last_granulepos = (granulepos_hi << 22) | (granulepos_low); ++ GST_BUFFER_OFFSET_END (buf) = schro_enc->last_granulepos; ++ } ++ ++ gst_buffer_set_caps (buf, base_video_encoder->caps); ++ ++ return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), buf); ++} ++ ++static GstFlowReturn ++gst_schro_enc_shape_output_quicktime (GstBaseVideoEncoder * base_video_encoder, ++ GstVideoFrame * frame) ++{ ++ GstBuffer *buf = frame->src_buffer; ++ const GstVideoState *state; ++ ++ state = gst_base_video_encoder_get_state (base_video_encoder); ++ ++ GST_BUFFER_TIMESTAMP (buf) = gst_video_state_get_timestamp (state, ++ frame->presentation_frame_number); ++ GST_BUFFER_DURATION (buf) = gst_video_state_get_timestamp (state, ++ frame->presentation_frame_number + 1) - GST_BUFFER_TIMESTAMP (buf); ++ GST_BUFFER_OFFSET_END (buf) = gst_video_state_get_timestamp (state, ++ frame->system_frame_number); ++ GST_BUFFER_OFFSET (buf) = GST_CLOCK_TIME_NONE; ++ ++ if (frame->is_sync_point && ++ frame->presentation_frame_number == frame->system_frame_number) { ++ GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DELTA_UNIT); ++ } else { ++ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); ++ } ++ ++ gst_buffer_set_caps (buf, base_video_encoder->caps); ++ ++ return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), buf); ++} ++ ++static GstFlowReturn ++gst_schro_enc_shape_output_mp4 (GstBaseVideoEncoder * base_video_encoder, ++ GstVideoFrame * frame) ++{ ++ GstBuffer *buf = frame->src_buffer; ++ const GstVideoState *state; ++ ++ state = gst_base_video_encoder_get_state (base_video_encoder); ++ ++ GST_BUFFER_TIMESTAMP (buf) = gst_video_state_get_timestamp (state, ++ frame->presentation_frame_number); ++ GST_BUFFER_DURATION (buf) = gst_video_state_get_timestamp (state, ++ frame->presentation_frame_number + 1) - GST_BUFFER_TIMESTAMP (buf); ++ GST_BUFFER_OFFSET_END (buf) = gst_video_state_get_timestamp (state, ++ frame->decode_frame_number); ++ GST_BUFFER_OFFSET (buf) = GST_CLOCK_TIME_NONE; ++ ++ GST_BUFFER_OFFSET_END (buf) = gst_video_state_get_timestamp (state, ++ frame->system_frame_number); ++ ++ if (frame->is_sync_point && ++ frame->presentation_frame_number == frame->system_frame_number) { ++ GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DELTA_UNIT); ++ } else { ++ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); ++ } ++ ++ gst_buffer_set_caps (buf, base_video_encoder->caps); ++ ++ return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), buf); ++} ++ ++static GstFlowReturn ++gst_schro_enc_shape_output (GstBaseVideoEncoder * base_video_encoder, ++ GstVideoFrame * frame) ++{ ++ GstSchroEnc *schro_enc; ++ ++ schro_enc = GST_SCHRO_ENC (base_video_encoder); ++ ++ switch (schro_enc->output_format) { ++ case GST_SCHRO_ENC_OUTPUT_OGG: ++ return gst_schro_enc_shape_output_ogg (base_video_encoder, frame); ++ case GST_SCHRO_ENC_OUTPUT_QUICKTIME: ++ return gst_schro_enc_shape_output_quicktime (base_video_encoder, frame); ++ case GST_SCHRO_ENC_OUTPUT_MP4: ++ return gst_schro_enc_shape_output_mp4 (base_video_encoder, frame); ++ default: ++ g_assert_not_reached (); ++ break; ++ } ++ ++ return GST_FLOW_ERROR; ++} ++ ++static GstFlowReturn ++gst_schro_enc_process (GstSchroEnc * schro_enc) ++{ ++ SchroBuffer *encoded_buffer; ++ GstVideoFrame *frame; ++ GstFlowReturn ret; ++ int presentation_frame; ++ void *voidptr; ++ GstBaseVideoEncoder *base_video_encoder = GST_BASE_VIDEO_ENCODER (schro_enc); ++ ++ GST_DEBUG ("process"); ++ ++ while (1) { ++ switch (schro_encoder_wait (schro_enc->encoder)) { ++ case SCHRO_STATE_NEED_FRAME: ++ return GST_FLOW_OK; ++ case SCHRO_STATE_END_OF_STREAM: ++ GST_DEBUG ("EOS"); ++ return GST_FLOW_OK; ++ case SCHRO_STATE_HAVE_BUFFER: ++ voidptr = NULL; ++ encoded_buffer = schro_encoder_pull_full (schro_enc->encoder, ++ &presentation_frame, &voidptr); ++ frame = voidptr; ++ if (encoded_buffer == NULL) { ++ GST_DEBUG ("encoder_pull returned NULL"); ++ /* FIXME This shouldn't happen */ ++ return GST_FLOW_ERROR; ++ } ++ ++ if (voidptr == NULL) { ++ GST_DEBUG ("got eos"); ++ frame = schro_enc->eos_frame; ++ } ++ ++ if (SCHRO_PARSE_CODE_IS_SEQ_HEADER (encoded_buffer->data[4])) { ++ frame->is_sync_point = TRUE; ++ } ++ ++ frame->src_buffer = gst_schro_wrap_schro_buffer (encoded_buffer); ++ ++ ret = gst_base_video_encoder_finish_frame (base_video_encoder, frame); ++ ++ if (ret != GST_FLOW_OK) { ++ GST_DEBUG ("pad_push returned %d", ret); ++ return ret; ++ } ++ break; ++ case SCHRO_STATE_AGAIN: ++ break; ++ } ++ } ++ return GST_FLOW_OK; ++} +diff -uNr schroedinger-1.0.8.orig/gst/gstschroparse.c schroedinger-1.0.8/gst/gstschroparse.c +--- schroedinger-1.0.8.orig/gst/gstschroparse.c 1970-01-01 01:00:00.000000000 +0100 ++++ schroedinger-1.0.8/gst/gstschroparse.c 2009-10-12 12:23:39.000000000 +0200 +@@ -0,0 +1,610 @@ ++/* Schrodinger ++ * Copyright (C) 2006 David Schleef ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library 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. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++ ++GST_DEBUG_CATEGORY_EXTERN (schro_debug); ++#define GST_CAT_DEFAULT schro_debug ++ ++#define GST_TYPE_SCHRO_PARSE \ ++ (gst_schro_parse_get_type()) ++#define GST_SCHRO_PARSE(obj) \ ++ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SCHRO_PARSE,GstSchroParse)) ++#define GST_SCHRO_PARSE_CLASS(klass) \ ++ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SCHRO_PARSE,GstSchroParseClass)) ++#define GST_IS_SCHRO_PARSE(obj) \ ++ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SCHRO_PARSE)) ++#define GST_IS_SCHRO_PARSE_CLASS(obj) \ ++ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SCHRO_PARSE)) ++ ++typedef struct _GstSchroParse GstSchroParse; ++typedef struct _GstSchroParseClass GstSchroParseClass; ++ ++typedef enum ++{ ++ GST_SCHRO_PARSE_OUTPUT_OGG, ++ GST_SCHRO_PARSE_OUTPUT_QUICKTIME, ++ GST_SCHRO_PARSE_OUTPUT_AVI, ++ GST_SCHRO_PARSE_OUTPUT_MPEG_TS, ++ GST_SCHRO_PARSE_OUTPUT_MP4 ++} GstSchroParseOutputType; ++ ++struct _GstSchroParse ++{ ++ GstBaseVideoParse base_video_parse; ++ ++ GstPad *sinkpad, *srcpad; ++ ++ GstSchroParseOutputType output_format; ++ ++ GstBuffer *seq_header_buffer; ++ ++ /* state */ ++ ++ ++ gboolean have_picture; ++ int buf_picture_number; ++ int seq_hdr_picture_number; ++ int picture_number; ++ ++ guint64 last_granulepos; ++ ++ int bytes_per_picture; ++}; ++ ++struct _GstSchroParseClass ++{ ++ GstBaseVideoParseClass base_video_parse_class; ++}; ++ ++/* GstSchroParse signals and args */ ++enum ++{ ++ LAST_SIGNAL ++}; ++ ++enum ++{ ++ ARG_0 ++}; ++ ++static void gst_schro_parse_finalize (GObject * object); ++ ++static gboolean gst_schro_parse_start (GstBaseVideoParse * base_video_parse); ++static gboolean gst_schro_parse_stop (GstBaseVideoParse * base_video_parse); ++static gboolean gst_schro_parse_reset (GstBaseVideoParse * base_video_parse); ++static int gst_schro_parse_scan_for_sync (GstAdapter * adapter, ++ gboolean at_eos, int offset, int n); ++static gboolean gst_schro_parse_parse_data (GstBaseVideoParse * ++ base_video_parse, gboolean at_eos); ++static gboolean gst_schro_parse_shape_output (GstBaseVideoParse * ++ base_video_parse, GstVideoFrame * frame); ++static GstCaps *gst_schro_parse_get_caps (GstBaseVideoParse * base_video_parse); ++ ++ ++ ++static GstStaticPadTemplate gst_schro_parse_sink_template = ++GST_STATIC_PAD_TEMPLATE ("sink", ++ GST_PAD_SINK, ++ GST_PAD_ALWAYS, ++ GST_STATIC_CAPS ("video/x-dirac") ++ ); ++ ++static GstStaticPadTemplate gst_schro_parse_src_template = ++ GST_STATIC_PAD_TEMPLATE ("src", ++ GST_PAD_SRC, ++ GST_PAD_ALWAYS, ++ GST_STATIC_CAPS ++ ("video/x-dirac;video/x-qt-part;video/x-avi-part;video/x-mp4-part") ++ ); ++ ++GST_BOILERPLATE (GstSchroParse, gst_schro_parse, GstBaseVideoParse, ++ GST_TYPE_BASE_VIDEO_PARSE); ++ ++static void ++gst_schro_parse_base_init (gpointer g_class) ++{ ++ static GstElementDetails compress_details = ++ GST_ELEMENT_DETAILS ("Dirac Parser", ++ "Codec/Parser/Video", ++ "Parse Dirac streams", ++ "David Schleef "); ++ GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); ++ ++ gst_element_class_add_pad_template (element_class, ++ gst_static_pad_template_get (&gst_schro_parse_src_template)); ++ gst_element_class_add_pad_template (element_class, ++ gst_static_pad_template_get (&gst_schro_parse_sink_template)); ++ ++ gst_element_class_set_details (element_class, &compress_details); ++} ++ ++static void ++gst_schro_parse_class_init (GstSchroParseClass * klass) ++{ ++ GObjectClass *gobject_class; ++ GstElementClass *element_class; ++ GstBaseVideoParseClass *base_video_parse_class; ++ ++ gobject_class = G_OBJECT_CLASS (klass); ++ element_class = GST_ELEMENT_CLASS (klass); ++ base_video_parse_class = GST_BASE_VIDEO_PARSE_CLASS (klass); ++ ++ gobject_class->finalize = gst_schro_parse_finalize; ++ ++ base_video_parse_class->start = GST_DEBUG_FUNCPTR (gst_schro_parse_start); ++ base_video_parse_class->stop = GST_DEBUG_FUNCPTR (gst_schro_parse_stop); ++ base_video_parse_class->reset = GST_DEBUG_FUNCPTR (gst_schro_parse_reset); ++ base_video_parse_class->parse_data = ++ GST_DEBUG_FUNCPTR (gst_schro_parse_parse_data); ++ base_video_parse_class->shape_output = ++ GST_DEBUG_FUNCPTR (gst_schro_parse_shape_output); ++ base_video_parse_class->scan_for_sync = ++ GST_DEBUG_FUNCPTR (gst_schro_parse_scan_for_sync); ++ base_video_parse_class->get_caps = ++ GST_DEBUG_FUNCPTR (gst_schro_parse_get_caps); ++ ++} ++ ++static void ++gst_schro_parse_init (GstSchroParse * schro_parse, GstSchroParseClass * klass) ++{ ++ GstBaseVideoParse *base_video_parse = GST_BASE_VIDEO_PARSE (schro_parse); ++ ++ GST_DEBUG ("gst_schro_parse_init"); ++ ++ schro_parse->output_format = GST_SCHRO_PARSE_OUTPUT_OGG; ++ ++ base_video_parse->reorder_depth = 2; ++} ++ ++static gboolean ++gst_schro_parse_reset (GstBaseVideoParse * base_video_parse) ++{ ++ GstSchroParse *schro_parse; ++ ++ schro_parse = GST_SCHRO_PARSE (base_video_parse); ++ ++ GST_DEBUG ("reset"); ++ ++ return TRUE; ++} ++ ++static void ++gst_schro_parse_finalize (GObject * object) ++{ ++ GstSchroParse *schro_parse; ++ ++ g_return_if_fail (GST_IS_SCHRO_PARSE (object)); ++ schro_parse = GST_SCHRO_PARSE (object); ++ ++ G_OBJECT_CLASS (parent_class)->finalize (object); ++} ++ ++static gboolean ++gst_schro_parse_start (GstBaseVideoParse * base_video_parse) ++{ ++ GstSchroParse *schro_parse = GST_SCHRO_PARSE (base_video_parse); ++ GstCaps *caps; ++ GstStructure *structure; ++ ++ GST_DEBUG ("start"); ++ caps = ++ gst_pad_get_allowed_caps (GST_BASE_VIDEO_CODEC_SRC_PAD ++ (base_video_parse)); ++ ++ if (gst_caps_is_empty (caps)) { ++ gst_caps_unref (caps); ++ return FALSE; ++ } ++ ++ structure = gst_caps_get_structure (caps, 0); ++ ++ if (gst_structure_has_name (structure, "video/x-dirac")) { ++ schro_parse->output_format = GST_SCHRO_PARSE_OUTPUT_OGG; ++ } else if (gst_structure_has_name (structure, "video/x-qt-part")) { ++ schro_parse->output_format = GST_SCHRO_PARSE_OUTPUT_QUICKTIME; ++ } else if (gst_structure_has_name (structure, "video/x-avi-part")) { ++ schro_parse->output_format = GST_SCHRO_PARSE_OUTPUT_AVI; ++ } else if (gst_structure_has_name (structure, "video/x-mpegts-part")) { ++ schro_parse->output_format = GST_SCHRO_PARSE_OUTPUT_MPEG_TS; ++ } else if (gst_structure_has_name (structure, "video/x-mp4-part")) { ++ schro_parse->output_format = GST_SCHRO_PARSE_OUTPUT_MP4; ++ } else { ++ return FALSE; ++ } ++ ++ gst_caps_unref (caps); ++ return TRUE; ++} ++ ++static gboolean ++gst_schro_parse_stop (GstBaseVideoParse * base_video_parse) ++{ ++ return TRUE; ++} ++ ++static void ++parse_sequence_header (GstSchroParse * schro_parse, guint8 * data, int size) ++{ ++ SchroVideoFormat video_format; ++ int ret; ++ GstVideoState *state; ++ ++ GST_DEBUG ("parse_sequence_header size=%d", size); ++ ++ state = gst_base_video_parse_get_state (GST_BASE_VIDEO_PARSE (schro_parse)); ++ ++ schro_parse->seq_header_buffer = gst_buffer_new_and_alloc (size); ++ memcpy (GST_BUFFER_DATA (schro_parse->seq_header_buffer), data, size); ++ ++ ret = schro_parse_decode_sequence_header (data + 13, size - 13, ++ &video_format); ++ if (ret) { ++ state->fps_n = video_format.frame_rate_numerator; ++ state->fps_d = video_format.frame_rate_denominator; ++ GST_DEBUG ("Frame rate is %d/%d", state->fps_n, state->fps_d); ++ ++ state->width = video_format.width; ++ state->height = video_format.height; ++ GST_DEBUG ("Frame dimensions are %d x %d\n", state->width, state->height); ++ ++ state->clean_width = video_format.clean_width; ++ state->clean_height = video_format.clean_height; ++ state->clean_offset_left = video_format.left_offset; ++ state->clean_offset_top = video_format.top_offset; ++ ++ state->par_n = video_format.aspect_ratio_numerator; ++ state->par_d = video_format.aspect_ratio_denominator; ++ GST_DEBUG ("Pixel aspect ratio is %d/%d", state->par_n, state->par_d); ++ ++ gst_base_video_parse_set_state (GST_BASE_VIDEO_PARSE (schro_parse), state); ++ } else { ++ GST_WARNING ("Failed to get frame rate from sequence header"); ++ } ++ ++} ++ ++static int ++gst_schro_parse_scan_for_sync (GstAdapter * adapter, gboolean at_eos, ++ int offset, int n) ++{ ++ int n_available = gst_adapter_available (adapter) - offset; ++ ++ if (n_available < 4) { ++ if (at_eos) { ++ return n_available; ++ } else { ++ return 0; ++ } ++ } ++ ++ n_available -= 3; ++ ++ return gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x42424344, ++ offset, MIN (n, n_available - 3)); ++} ++ ++static GstFlowReturn ++gst_schro_parse_parse_data (GstBaseVideoParse * base_video_parse, ++ gboolean at_eos) ++{ ++ GstSchroParse *schro_parse; ++ unsigned char header[SCHRO_PARSE_HEADER_SIZE]; ++ int next; ++ int prev; ++ int parse_code; ++ ++ GST_DEBUG ("parse_data"); ++ ++ schro_parse = GST_SCHRO_PARSE (base_video_parse); ++ ++ if (gst_adapter_available (base_video_parse->input_adapter) < ++ SCHRO_PARSE_HEADER_SIZE) { ++ return GST_BASE_VIDEO_PARSE_FLOW_NEED_DATA; ++ } ++ ++ GST_DEBUG ("available %d", ++ gst_adapter_available (base_video_parse->input_adapter)); ++ ++ gst_adapter_copy (base_video_parse->input_adapter, header, 0, ++ SCHRO_PARSE_HEADER_SIZE); ++ ++ parse_code = header[4]; ++ next = GST_READ_UINT32_BE (header + 5); ++ prev = GST_READ_UINT32_BE (header + 9); ++ ++ GST_DEBUG ("%08x %02x %08x %08x", ++ GST_READ_UINT32_BE (header), parse_code, next, prev); ++ ++ if (memcmp (header, "BBCD", 4) != 0 || ++ (next & 0xf0000000) || (prev & 0xf0000000)) { ++ gst_base_video_parse_lost_sync (base_video_parse); ++ return GST_BASE_VIDEO_PARSE_FLOW_NEED_DATA; ++ } ++ ++ if (SCHRO_PARSE_CODE_IS_END_OF_SEQUENCE (parse_code)) { ++ GstVideoFrame *frame; ++ ++ if (next != 0 && next != SCHRO_PARSE_HEADER_SIZE) { ++ GST_WARNING ("next is not 0 or 13 in EOS packet (%d)", next); ++ } ++ ++ gst_base_video_parse_add_to_frame (base_video_parse, ++ SCHRO_PARSE_HEADER_SIZE); ++ ++ frame = gst_base_video_parse_get_frame (base_video_parse); ++ frame->is_eos = TRUE; ++ ++ SCHRO_DEBUG ("eos"); ++ ++ return gst_base_video_parse_finish_frame (base_video_parse); ++ } ++ ++ if (gst_adapter_available (base_video_parse->input_adapter) < next) { ++ return GST_BASE_VIDEO_PARSE_FLOW_NEED_DATA; ++ } ++ ++ if (SCHRO_PARSE_CODE_IS_SEQ_HEADER (parse_code)) { ++ guint8 *data; ++ ++ data = g_malloc (next); ++ ++ gst_adapter_copy (base_video_parse->input_adapter, data, 0, next); ++ parse_sequence_header (schro_parse, data, next); ++ ++ base_video_parse->current_frame->is_sync_point = TRUE; ++ ++ g_free (data); ++ } ++ ++ if (schro_parse->seq_header_buffer == NULL) { ++ gst_adapter_flush (base_video_parse->input_adapter, next); ++ return GST_FLOW_OK; ++ } ++ ++ if (SCHRO_PARSE_CODE_IS_PICTURE (parse_code)) { ++ GstVideoFrame *frame; ++ guint8 tmp[4]; ++ ++ frame = gst_base_video_parse_get_frame (base_video_parse); ++ ++#if 0 ++ if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buf))) { ++ frame->presentation_timestamp = GST_BUFFER_TIMESTAMP (buf); ++ } ++#endif ++ ++ gst_adapter_copy (base_video_parse->input_adapter, tmp, ++ SCHRO_PARSE_HEADER_SIZE, 4); ++ ++ frame->presentation_frame_number = GST_READ_UINT32_BE (tmp); ++ ++ gst_base_video_parse_add_to_frame (base_video_parse, next); ++ ++ return gst_base_video_parse_finish_frame (base_video_parse); ++ } else { ++ gst_base_video_parse_add_to_frame (base_video_parse, next); ++ } ++ ++ return GST_FLOW_OK; ++} ++ ++static GstFlowReturn ++gst_schro_parse_shape_output_ogg (GstBaseVideoParse * base_video_parse, ++ GstVideoFrame * frame) ++{ ++ GstSchroParse *schro_parse; ++ int dpn; ++ int delay; ++ int dist; ++ int pt; ++ int dt; ++ guint64 granulepos_hi; ++ guint64 granulepos_low; ++ GstBuffer *buf = frame->src_buffer; ++ ++ schro_parse = GST_SCHRO_PARSE (base_video_parse); ++ ++ dpn = frame->decode_frame_number; ++ ++ pt = frame->presentation_frame_number * 2; ++ dt = frame->decode_frame_number * 2; ++ delay = pt - dt; ++ dist = frame->distance_from_sync; ++ ++ GST_DEBUG ("sys %d dpn %d pt %d dt %d delay %d dist %d", ++ (int) frame->system_frame_number, ++ (int) frame->decode_frame_number, pt, dt, delay, dist); ++ ++ granulepos_hi = (((guint64) pt - delay) << 9) | ((dist >> 8)); ++ granulepos_low = (delay << 9) | (dist & 0xff); ++ GST_DEBUG ("granulepos %" G_GINT64_FORMAT ":%" G_GINT64_FORMAT, granulepos_hi, ++ granulepos_low); ++ ++ if (frame->is_eos) { ++ GST_BUFFER_OFFSET_END (buf) = schro_parse->last_granulepos; ++ } else { ++ schro_parse->last_granulepos = (granulepos_hi << 22) | (granulepos_low); ++ GST_BUFFER_OFFSET_END (buf) = schro_parse->last_granulepos; ++ } ++ ++ return gst_base_video_parse_push (base_video_parse, buf); ++} ++ ++static GstFlowReturn ++gst_schro_parse_shape_output_quicktime (GstBaseVideoParse * base_video_parse, ++ GstVideoFrame * frame) ++{ ++ GstBuffer *buf = frame->src_buffer; ++ const GstVideoState *state; ++ ++ state = gst_base_video_parse_get_state (base_video_parse); ++ ++ GST_BUFFER_OFFSET_END (buf) = gst_video_state_get_timestamp (state, ++ frame->system_frame_number); ++ ++ if (frame->is_sync_point && ++ frame->presentation_frame_number == frame->system_frame_number) { ++ GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DELTA_UNIT); ++ GST_DEBUG ("sync point"); ++ } else { ++ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); ++ } ++ ++ return gst_base_video_parse_push (base_video_parse, buf); ++} ++ ++static GstFlowReturn ++gst_schro_parse_shape_output_mpeg_ts (GstBaseVideoParse * base_video_parse, ++ GstVideoFrame * frame) ++{ ++ GstBuffer *buf = frame->src_buffer; ++ const GstVideoState *state; ++ ++ state = gst_base_video_parse_get_state (base_video_parse); ++ ++ return gst_base_video_parse_push (base_video_parse, buf); ++} ++ ++static GstFlowReturn ++gst_schro_parse_shape_output (GstBaseVideoParse * base_video_parse, ++ GstVideoFrame * frame) ++{ ++ GstSchroParse *schro_parse; ++ ++ schro_parse = GST_SCHRO_PARSE (base_video_parse); ++ ++ switch (schro_parse->output_format) { ++ case GST_SCHRO_PARSE_OUTPUT_OGG: ++ return gst_schro_parse_shape_output_ogg (base_video_parse, frame); ++ case GST_SCHRO_PARSE_OUTPUT_QUICKTIME: ++ return gst_schro_parse_shape_output_quicktime (base_video_parse, frame); ++ case GST_SCHRO_PARSE_OUTPUT_MPEG_TS: ++ return gst_schro_parse_shape_output_mpeg_ts (base_video_parse, frame); ++ default: ++ break; ++ } ++ ++ return GST_FLOW_ERROR; ++} ++ ++static GstCaps * ++gst_schro_parse_get_caps (GstBaseVideoParse * base_video_parse) ++{ ++ GstCaps *caps; ++ GstVideoState *state; ++ GstSchroParse *schro_parse; ++ ++ schro_parse = GST_SCHRO_PARSE (base_video_parse); ++ ++ state = gst_base_video_parse_get_state (base_video_parse); ++ ++ if (schro_parse->output_format == GST_SCHRO_PARSE_OUTPUT_OGG) { ++ caps = gst_caps_new_simple ("video/x-dirac", ++ "width", G_TYPE_INT, state->width, ++ "height", G_TYPE_INT, state->height, ++ "framerate", GST_TYPE_FRACTION, state->fps_n, ++ state->fps_d, ++ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, ++ state->par_d, NULL); ++ ++ GST_BUFFER_FLAG_SET (schro_parse->seq_header_buffer, ++ GST_BUFFER_FLAG_IN_CAPS); ++ ++ { ++ GValue array = { 0 }; ++ GValue value = { 0 }; ++ GstBuffer *buf; ++ int size; ++ ++ g_value_init (&array, GST_TYPE_ARRAY); ++ g_value_init (&value, GST_TYPE_BUFFER); ++ size = GST_BUFFER_SIZE (schro_parse->seq_header_buffer); ++ buf = gst_buffer_new_and_alloc (size + SCHRO_PARSE_HEADER_SIZE); ++ memcpy (GST_BUFFER_DATA (buf), ++ GST_BUFFER_DATA (schro_parse->seq_header_buffer), size); ++ GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf) + size + 0, 0x42424344); ++ GST_WRITE_UINT8 (GST_BUFFER_DATA (buf) + size + 4, ++ SCHRO_PARSE_CODE_END_OF_SEQUENCE); ++ GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf) + size + 5, 0); ++ GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf) + size + 9, size); ++ gst_value_set_buffer (&value, buf); ++ gst_buffer_unref (buf); ++ gst_value_array_append_value (&array, &value); ++ gst_structure_set_value (gst_caps_get_structure (caps, 0), ++ "streamheader", &array); ++ g_value_unset (&value); ++ g_value_unset (&array); ++ } ++ } else if (schro_parse->output_format == GST_SCHRO_PARSE_OUTPUT_QUICKTIME) { ++ caps = gst_caps_new_simple ("video/x-qt-part", ++ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'), ++ "width", G_TYPE_INT, state->width, ++ "height", G_TYPE_INT, state->height, ++ "framerate", GST_TYPE_FRACTION, state->fps_n, ++ state->fps_d, ++ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, ++ state->par_d, NULL); ++ } else if (schro_parse->output_format == GST_SCHRO_PARSE_OUTPUT_AVI) { ++ caps = gst_caps_new_simple ("video/x-avi-part", ++ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'), ++ "width", G_TYPE_INT, state->width, ++ "height", G_TYPE_INT, state->height, ++ "framerate", GST_TYPE_FRACTION, state->fps_n, ++ state->fps_d, ++ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, ++ state->par_d, NULL); ++ } else if (schro_parse->output_format == GST_SCHRO_PARSE_OUTPUT_MPEG_TS) { ++ caps = gst_caps_new_simple ("video/x-mpegts-part", ++ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'), ++ "width", G_TYPE_INT, state->width, ++ "height", G_TYPE_INT, state->height, ++ "framerate", GST_TYPE_FRACTION, state->fps_n, ++ state->fps_d, ++ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, ++ state->par_d, NULL); ++ } else if (schro_parse->output_format == GST_SCHRO_PARSE_OUTPUT_MP4) { ++ caps = gst_caps_new_simple ("video/x-mp4-part", ++ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'), ++ "width", G_TYPE_INT, state->width, ++ "height", G_TYPE_INT, state->height, ++ "framerate", GST_TYPE_FRACTION, state->fps_n, ++ state->fps_d, ++ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, ++ state->par_d, NULL); ++ } else { ++ g_assert_not_reached (); ++ } ++ ++ return caps; ++} +diff -uNr schroedinger-1.0.8.orig/gst/gstschroutils.c schroedinger-1.0.8/gst/gstschroutils.c +--- schroedinger-1.0.8.orig/gst/gstschroutils.c 1970-01-01 01:00:00.000000000 +0100 ++++ schroedinger-1.0.8/gst/gstschroutils.c 2009-09-11 17:35:39.000000000 +0200 +@@ -0,0 +1,149 @@ ++/* Schrodinger ++ * Copyright (C) 2008 David Schleef ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library 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. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++//#define SCHRO_ENABLE_UNSTABLE_API ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++GST_DEBUG_CATEGORY_EXTERN (schro_debug); ++#define GST_CAT_DEFAULT schro_debug ++ ++ ++ ++ ++static void ++gst_schro_frame_free (SchroFrame * frame, void *priv) ++{ ++ gst_buffer_unref (GST_BUFFER (priv)); ++} ++ ++SchroFrame * ++gst_schro_buffer_wrap (GstBuffer * buf, GstVideoFormat format, int width, ++ int height) ++{ ++ SchroFrame *frame; ++ ++ switch (format) { ++ case GST_VIDEO_FORMAT_I420: ++ frame = ++ schro_frame_new_from_data_I420 (GST_BUFFER_DATA (buf), width, height); ++ break; ++ case GST_VIDEO_FORMAT_YV12: ++ frame = ++ schro_frame_new_from_data_YV12 (GST_BUFFER_DATA (buf), width, height); ++ break; ++ case GST_VIDEO_FORMAT_YUY2: ++ frame = ++ schro_frame_new_from_data_YUY2 (GST_BUFFER_DATA (buf), width, height); ++ break; ++ case GST_VIDEO_FORMAT_UYVY: ++ frame = ++ schro_frame_new_from_data_UYVY (GST_BUFFER_DATA (buf), width, height); ++ break; ++ case GST_VIDEO_FORMAT_AYUV: ++ frame = ++ schro_frame_new_from_data_AYUV (GST_BUFFER_DATA (buf), width, height); ++ break; ++#if 0 ++ case GST_VIDEO_FORMAT_ARGB: ++ { ++ SchroFrame *rgbframe = ++ schro_frame_new_from_data_AYUV (GST_BUFFER_DATA (buf), width, height); ++ SchroFrame *vframe1; ++ SchroFrame *vframe2; ++ SchroFrame *vframe3; ++ ++ vframe1 = schro_virt_frame_new_unpack (rgbframe); ++ vframe2 = schro_virt_frame_new_color_matrix (vframe1); ++ vframe3 = ++ schro_virt_frame_new_subsample (vframe2, SCHRO_FRAME_FORMAT_U8_420); ++ ++ frame = schro_frame_new_and_alloc (NULL, SCHRO_FRAME_FORMAT_U8_420, ++ width, height); ++ schro_virt_frame_render (vframe3, frame); ++ schro_frame_unref (vframe3); ++ } ++ break; ++#endif ++ default: ++ g_assert_not_reached (); ++ } ++ schro_frame_set_free_callback (frame, gst_schro_frame_free, buf); ++ ++ return frame; ++} ++ ++#ifdef GST_BUFFER_FREE_FUNC ++static void ++schro_buf_free_func (gpointer priv) ++{ ++ SchroBuffer *buffer = (SchroBuffer *) priv; ++ ++ schro_buffer_unref (buffer); ++} ++#endif ++ ++/* takes the reference */ ++GstBuffer * ++gst_schro_wrap_schro_buffer (SchroBuffer * buffer) ++{ ++ GstBuffer *gstbuf; ++ ++#ifdef GST_BUFFER_FREE_FUNC ++ gstbuf = gst_buffer_new (); ++ GST_BUFFER_DATA (gstbuf) = buffer->data; ++ GST_BUFFER_SIZE (gstbuf) = buffer->length; ++ GST_BUFFER_MALLOCDATA (gstbuf) = (void *) buffer; ++ GST_BUFFER_FREE_FUNC (gstbuf) = schro_buf_free_func; ++#else ++ gstbuf = gst_buffer_new_and_alloc (buffer->length); ++ memcpy (GST_BUFFER_DATA (gstbuf), buffer->data, buffer->length); ++#endif ++ ++ return gstbuf; ++} ++ ++static void ++gst_schro_buffer_free (SchroBuffer * buffer, void *priv) ++{ ++ gst_buffer_unref (GST_BUFFER (priv)); ++} ++ ++SchroBuffer * ++gst_schro_wrap_gst_buffer (GstBuffer * buffer) ++{ ++ SchroBuffer *schrobuf; ++ ++ schrobuf = schro_buffer_new_with_data (GST_BUFFER_DATA (buffer), ++ GST_BUFFER_SIZE (buffer)); ++ schrobuf->free = gst_schro_buffer_free; ++ schrobuf->priv = buffer; ++ ++ return schrobuf; ++} +diff -uNr schroedinger-1.0.8.orig/gst/gstschroutils.h schroedinger-1.0.8/gst/gstschroutils.h +--- schroedinger-1.0.8.orig/gst/gstschroutils.h 1970-01-01 01:00:00.000000000 +0100 ++++ schroedinger-1.0.8/gst/gstschroutils.h 2009-09-11 17:35:39.000000000 +0200 +@@ -0,0 +1,34 @@ ++/* Schrodinger ++ * Copyright (C) 2008 David Schleef ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library 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. ++ */ ++ ++#ifndef _GST_SCHRO_UTILS_H_ ++#define _GST_SCHRO_UTILS_H_ ++ ++#include ++#include ++#include ++ ++SchroFrame * ++gst_schro_buffer_wrap (GstBuffer *buf, GstVideoFormat format, int width, ++ int height); ++GstBuffer * gst_schro_wrap_schro_buffer (SchroBuffer *buffer); ++SchroBuffer * gst_schro_wrap_gst_buffer (GstBuffer *buffer); ++ ++#endif ++ +diff -uNr schroedinger-1.0.8.orig/gst/Makefile.am schroedinger-1.0.8/gst/Makefile.am +--- schroedinger-1.0.8.orig/gst/Makefile.am 1970-01-01 01:00:00.000000000 +0100 ++++ schroedinger-1.0.8/gst/Makefile.am 2009-10-12 12:23:39.000000000 +0200 +@@ -0,0 +1,27 @@ ++ ++plugin_LTLIBRARIES = libgstschro.la ++ ++noinst_HEADERS = \ ++ gstschroutils.h ++ ++libgstschro_la_SOURCES = \ ++ gstschro.c \ ++ gstschrodec.c \ ++ gstschroenc.c \ ++ gstschroparse.c \ ++ gstschroutils.c ++libgstschro_la_CFLAGS = \ ++ $(GST_CFLAGS) \ ++ $(GST_PLUGINS_BASE_CFLAGS) \ ++ $(GST_BASE_CFLAGS) \ ++ -DGST_USE_UNSTABLE_API \ ++ $(SCHRO_CFLAGS) -I$(top_srcdir)/gst-libs ++libgstschro_la_LIBADD = \ ++ $(top_builddir)/gst-libs/gst/video/libgstbasevideo-@GST_MAJORMINOR@.la \ ++ $(GST_PLUGINS_BASE_LIBS) -lgstvideo-@GST_MAJORMINOR@ \ ++ $(GST_BASE_LIBS) $(GST_LIBS) \ ++ $(SCHRO_LIBS) ++libgstschro_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) ++libgstschro_la_LIBTOOLFLAGS = --tag=disable-static ++ ++ +diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideocodec.c schroedinger-1.0.8/gst-libs/gst/video/gstbasevideocodec.c +--- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideocodec.c 1970-01-01 01:00:00.000000000 +0100 ++++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideocodec.c 2009-09-11 17:35:39.000000000 +0200 +@@ -0,0 +1,565 @@ ++/* Schrodinger ++ * Copyright (C) 2006 David Schleef ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library 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. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include "gstbasevideocodec.h" ++ ++#include ++#include ++ ++GST_DEBUG_CATEGORY (basevideo_debug); ++#define GST_CAT_DEFAULT basevideo_debug ++ ++/* GstBaseVideoCodec signals and args */ ++enum ++{ ++ LAST_SIGNAL ++}; ++ ++enum ++{ ++ ARG_0 ++}; ++ ++static void gst_base_video_codec_finalize (GObject * object); ++ ++static GstStateChangeReturn gst_base_video_codec_change_state (GstElement * ++ element, GstStateChange transition); ++ ++ ++GST_BOILERPLATE (GstBaseVideoCodec, gst_base_video_codec, GstElement, ++ GST_TYPE_ELEMENT); ++ ++static void ++gst_base_video_codec_base_init (gpointer g_class) ++{ ++ GST_DEBUG_CATEGORY_INIT (basevideo_debug, "basevideo", 0, ++ "Base Video Classes"); ++ ++} ++ ++static void ++gst_base_video_codec_class_init (GstBaseVideoCodecClass * klass) ++{ ++ GObjectClass *gobject_class; ++ GstElementClass *element_class; ++ ++ gobject_class = G_OBJECT_CLASS (klass); ++ element_class = GST_ELEMENT_CLASS (klass); ++ ++ gobject_class->finalize = gst_base_video_codec_finalize; ++ ++ element_class->change_state = gst_base_video_codec_change_state; ++} ++ ++static void ++gst_base_video_codec_init (GstBaseVideoCodec * base_video_codec, ++ GstBaseVideoCodecClass * klass) ++{ ++ GstPadTemplate *pad_template; ++ ++ GST_DEBUG ("gst_base_video_codec_init"); ++ ++ pad_template = ++ gst_element_class_get_pad_template (GST_ELEMENT_CLASS (klass), "sink"); ++ g_return_if_fail (pad_template != NULL); ++ ++ base_video_codec->sinkpad = gst_pad_new_from_template (pad_template, "sink"); ++ gst_element_add_pad (GST_ELEMENT (base_video_codec), ++ base_video_codec->sinkpad); ++ ++ pad_template = ++ gst_element_class_get_pad_template (GST_ELEMENT_CLASS (klass), "src"); ++ g_return_if_fail (pad_template != NULL); ++ ++ base_video_codec->srcpad = gst_pad_new_from_template (pad_template, "src"); ++ gst_pad_use_fixed_caps (base_video_codec->srcpad); ++ gst_element_add_pad (GST_ELEMENT (base_video_codec), ++ base_video_codec->srcpad); ++ ++ base_video_codec->input_adapter = gst_adapter_new (); ++ base_video_codec->output_adapter = gst_adapter_new (); ++ ++} ++ ++static void ++gst_base_video_codec_reset (GstBaseVideoCodec * base_video_codec) ++{ ++ GST_DEBUG ("reset"); ++ ++ base_video_codec->system_frame_number = 0; ++ ++ gst_adapter_clear (base_video_codec->input_adapter); ++ gst_adapter_clear (base_video_codec->output_adapter); ++ ++} ++ ++static void ++gst_base_video_codec_finalize (GObject * object) ++{ ++ GstBaseVideoCodec *base_video_codec; ++ ++ g_return_if_fail (GST_IS_BASE_VIDEO_CODEC (object)); ++ base_video_codec = GST_BASE_VIDEO_CODEC (object); ++ ++ if (base_video_codec->input_adapter) { ++ g_object_unref (base_video_codec->input_adapter); ++ } ++ if (base_video_codec->output_adapter) { ++ g_object_unref (base_video_codec->output_adapter); ++ } ++ ++ G_OBJECT_CLASS (parent_class)->finalize (object); ++} ++ ++#ifdef unused ++static const GstQueryType * ++gst_base_video_codec_get_query_types (GstPad * pad) ++{ ++ static const GstQueryType query_types[] = { ++ GST_QUERY_POSITION, ++ GST_QUERY_DURATION, ++ GST_QUERY_CONVERT, ++ 0 ++ }; ++ ++ return query_types; ++} ++#endif ++ ++#if 0 ++static gboolean ++gst_base_video_codec_src_convert (GstPad * pad, ++ GstFormat src_format, gint64 src_value, ++ GstFormat * dest_format, gint64 * dest_value) ++{ ++ gboolean res; ++ GstBaseVideoCodec *dec; ++ ++ if (src_format == *dest_format) { ++ *dest_value = src_value; ++ return TRUE; ++ } ++ ++ dec = GST_BASE_VIDEO_CODEC (gst_pad_get_parent (pad)); ++ ++ if (src_format == GST_FORMAT_DEFAULT && *dest_format == GST_FORMAT_TIME) { ++ if (dec->fps_d != 0) { ++ *dest_value = gst_util_uint64_scale (granulepos_to_frame (src_value), ++ dec->fps_d * GST_SECOND, dec->fps_n); ++ res = TRUE; ++ } else { ++ res = FALSE; ++ } ++ } else { ++ GST_WARNING ("unhandled conversion from %d to %d", src_format, ++ *dest_format); ++ res = FALSE; ++ } ++ ++ gst_object_unref (dec); ++ ++ return res; ++} ++ ++static gboolean ++gst_base_video_codec_sink_convert (GstPad * pad, ++ GstFormat src_format, gint64 src_value, ++ GstFormat * dest_format, gint64 * dest_value) ++{ ++ gboolean res = TRUE; ++ GstBaseVideoCodec *dec; ++ ++ if (src_format == *dest_format) { ++ *dest_value = src_value; ++ return TRUE; ++ } ++ ++ dec = GST_BASE_VIDEO_CODEC (gst_pad_get_parent (pad)); ++ ++ /* FIXME: check if we are in a decoding state */ ++ ++ switch (src_format) { ++ case GST_FORMAT_DEFAULT: ++ switch (*dest_format) { ++ case GST_FORMAT_TIME: ++ *dest_value = gst_util_uint64_scale (src_value, ++ dec->fps_d * GST_SECOND, dec->fps_n); ++ break; ++ default: ++ res = FALSE; ++ } ++ break; ++ case GST_FORMAT_TIME: ++ switch (*dest_format) { ++ case GST_FORMAT_DEFAULT: ++ { ++ *dest_value = gst_util_uint64_scale (src_value, ++ dec->fps_n, dec->fps_d * GST_SECOND); ++ break; ++ } ++ default: ++ res = FALSE; ++ break; ++ } ++ break; ++ default: ++ res = FALSE; ++ break; ++ } ++ ++ gst_object_unref (dec); ++ ++ return res; ++} ++#endif ++ ++#ifdef unused ++static gboolean ++gst_base_video_codec_src_query (GstPad * pad, GstQuery * query) ++{ ++ GstBaseVideoCodec *base_codec; ++ gboolean res = FALSE; ++ ++ base_codec = GST_BASE_VIDEO_CODEC (gst_pad_get_parent (pad)); ++ ++ switch (GST_QUERY_TYPE (query)) { ++ case GST_QUERY_POSITION: ++ { ++ GstFormat format; ++ gint64 time; ++ gint64 value; ++ ++ gst_query_parse_position (query, &format, NULL); ++ ++ time = gst_util_uint64_scale (base_codec->system_frame_number, ++ base_codec->state.fps_n, base_codec->state.fps_d); ++ time += base_codec->state.segment.time; ++ GST_DEBUG ("query position %lld", time); ++ res = gst_base_video_encoded_video_convert (&base_codec->state, ++ GST_FORMAT_TIME, time, &format, &value); ++ if (!res) ++ goto error; ++ ++ gst_query_set_position (query, format, value); ++ break; ++ } ++ case GST_QUERY_DURATION: ++ res = gst_pad_query (GST_PAD_PEER (base_codec->sinkpad), query); ++ if (!res) ++ goto error; ++ break; ++ case GST_QUERY_CONVERT: ++ { ++ GstFormat src_fmt, dest_fmt; ++ gint64 src_val, dest_val; ++ ++ GST_DEBUG ("query convert"); ++ ++ gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); ++ res = gst_base_video_encoded_video_convert (&base_codec->state, ++ src_fmt, src_val, &dest_fmt, &dest_val); ++ if (!res) ++ goto error; ++ gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); ++ break; ++ } ++ default: ++ res = gst_pad_query_default (pad, query); ++ break; ++ } ++done: ++ gst_object_unref (base_codec); ++ ++ return res; ++error: ++ GST_DEBUG_OBJECT (base_codec, "query failed"); ++ goto done; ++} ++#endif ++ ++#ifdef unused ++static gboolean ++gst_base_video_codec_sink_query (GstPad * pad, GstQuery * query) ++{ ++ GstBaseVideoCodec *base_video_codec; ++ gboolean res = FALSE; ++ ++ base_video_codec = GST_BASE_VIDEO_CODEC (gst_pad_get_parent (pad)); ++ ++ switch (GST_QUERY_TYPE (query)) { ++ case GST_QUERY_CONVERT: ++ { ++ GstFormat src_fmt, dest_fmt; ++ gint64 src_val, dest_val; ++ ++ gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); ++ res = gst_base_video_encoded_video_convert (&base_video_codec->state, ++ src_fmt, src_val, &dest_fmt, &dest_val); ++ if (!res) ++ goto error; ++ gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); ++ break; ++ } ++ default: ++ res = gst_pad_query_default (pad, query); ++ break; ++ } ++done: ++ gst_object_unref (base_video_codec); ++ ++ return res; ++error: ++ GST_DEBUG_OBJECT (base_video_codec, "query failed"); ++ goto done; ++} ++#endif ++ ++#ifdef unused ++static gboolean ++gst_base_video_codec_src_event (GstPad * pad, GstEvent * event) ++{ ++ GstBaseVideoCodec *base_video_codec; ++ gboolean res = FALSE; ++ ++ base_video_codec = GST_BASE_VIDEO_CODEC (gst_pad_get_parent (pad)); ++ ++ switch (GST_EVENT_TYPE (event)) { ++ case GST_EVENT_SEEK: ++ { ++ GstFormat format, tformat; ++ gdouble rate; ++ GstEvent *real_seek; ++ GstSeekFlags flags; ++ GstSeekType cur_type, stop_type; ++ gint64 cur, stop; ++ gint64 tcur, tstop; ++ ++ gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, ++ &cur, &stop_type, &stop); ++ gst_event_unref (event); ++ ++ tformat = GST_FORMAT_TIME; ++ res = gst_base_video_encoded_video_convert (&base_video_codec->state, ++ format, cur, &tformat, &tcur); ++ if (!res) ++ goto convert_error; ++ res = gst_base_video_encoded_video_convert (&base_video_codec->state, ++ format, stop, &tformat, &tstop); ++ if (!res) ++ goto convert_error; ++ ++ real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME, ++ flags, cur_type, tcur, stop_type, tstop); ++ ++ res = gst_pad_push_event (base_video_codec->sinkpad, real_seek); ++ ++ break; ++ } ++#if 0 ++ case GST_EVENT_QOS: ++ { ++ gdouble proportion; ++ GstClockTimeDiff diff; ++ GstClockTime timestamp; ++ ++ gst_event_parse_qos (event, &proportion, &diff, ×tamp); ++ ++ GST_OBJECT_LOCK (base_video_codec); ++ base_video_codec->proportion = proportion; ++ base_video_codec->earliest_time = timestamp + diff; ++ GST_OBJECT_UNLOCK (base_video_codec); ++ ++ GST_DEBUG_OBJECT (base_video_codec, ++ "got QoS %" GST_TIME_FORMAT ", %" G_GINT64_FORMAT, ++ GST_TIME_ARGS (timestamp), diff); ++ ++ res = gst_pad_push_event (base_video_codec->sinkpad, event); ++ break; ++ } ++#endif ++ default: ++ res = gst_pad_push_event (base_video_codec->sinkpad, event); ++ break; ++ } ++done: ++ gst_object_unref (base_video_codec); ++ return res; ++ ++convert_error: ++ GST_DEBUG_OBJECT (base_video_codec, "could not convert format"); ++ goto done; ++} ++#endif ++ ++#ifdef unused ++static gboolean ++gst_base_video_codec_sink_event (GstPad * pad, GstEvent * event) ++{ ++ GstBaseVideoCodec *base_video_codec; ++ gboolean ret = FALSE; ++ ++ base_video_codec = GST_BASE_VIDEO_CODEC (gst_pad_get_parent (pad)); ++ ++ switch (GST_EVENT_TYPE (event)) { ++ case GST_EVENT_FLUSH_START: ++ ret = gst_pad_push_event (base_video_codec->srcpad, event); ++ break; ++ case GST_EVENT_FLUSH_STOP: ++ gst_base_video_codec_reset (base_video_codec); ++ ret = gst_pad_push_event (base_video_codec->srcpad, event); ++ break; ++ case GST_EVENT_EOS: ++ if (gst_base_video_codec_push_all (base_video_codec, ++ FALSE) == GST_FLOW_ERROR) { ++ gst_event_unref (event); ++ return FALSE; ++ } ++ ++ ret = gst_pad_push_event (base_video_codec->srcpad, event); ++ break; ++ case GST_EVENT_NEWSEGMENT: ++ { ++ gboolean update; ++ GstFormat format; ++ gdouble rate; ++ gint64 start, stop, time; ++ ++ gst_event_parse_new_segment (event, &update, &rate, &format, &start, ++ &stop, &time); ++ ++ if (format != GST_FORMAT_TIME) ++ goto newseg_wrong_format; ++ ++ if (rate <= 0.0) ++ goto newseg_wrong_rate; ++ ++ GST_DEBUG ("newsegment %lld %lld", start, time); ++ gst_segment_set_newsegment (&base_video_codec->state.segment, update, ++ rate, format, start, stop, time); ++ ++ ret = gst_pad_push_event (base_video_codec->srcpad, event); ++ break; ++ } ++ default: ++ ret = gst_pad_push_event (base_video_codec->srcpad, event); ++ break; ++ } ++done: ++ gst_object_unref (base_video_codec); ++ return ret; ++ ++newseg_wrong_format: ++ GST_DEBUG_OBJECT (base_video_codec, "received non TIME newsegment"); ++ gst_event_unref (event); ++ goto done; ++ ++newseg_wrong_rate: ++ GST_DEBUG_OBJECT (base_video_codec, "negative rates not supported"); ++ gst_event_unref (event); ++ goto done; ++} ++#endif ++ ++ ++static GstStateChangeReturn ++gst_base_video_codec_change_state (GstElement * element, ++ GstStateChange transition) ++{ ++ GstBaseVideoCodec *base_video_codec = GST_BASE_VIDEO_CODEC (element); ++ GstStateChangeReturn ret; ++ ++ switch (transition) { ++ case GST_STATE_CHANGE_NULL_TO_READY: ++ break; ++ case GST_STATE_CHANGE_READY_TO_PAUSED: ++ gst_base_video_codec_reset (base_video_codec); ++ break; ++ case GST_STATE_CHANGE_PAUSED_TO_PLAYING: ++ break; ++ default: ++ break; ++ } ++ ++ ret = parent_class->change_state (element, transition); ++ ++ switch (transition) { ++ case GST_STATE_CHANGE_PLAYING_TO_PAUSED: ++ break; ++ case GST_STATE_CHANGE_PAUSED_TO_READY: ++ gst_base_video_codec_reset (base_video_codec); ++ break; ++ case GST_STATE_CHANGE_READY_TO_NULL: ++ break; ++ default: ++ break; ++ } ++ ++ return ret; ++} ++ ++#if 0 ++guint64 ++gst_base_video_codec_get_timestamp (GstBaseVideoCodec * base_video_codec, ++ int picture_number) ++{ ++ if (picture_number < 0) { ++ return base_video_codec->timestamp_offset - ++ (gint64) gst_util_uint64_scale (-picture_number, ++ base_video_codec->state.fps_d * GST_SECOND, ++ base_video_codec->state.fps_n); ++ } else { ++ return base_video_codec->timestamp_offset + ++ gst_util_uint64_scale (picture_number, ++ base_video_codec->state.fps_d * GST_SECOND, ++ base_video_codec->state.fps_n); ++ } ++} ++#endif ++ ++GstVideoFrame * ++gst_base_video_codec_new_frame (GstBaseVideoCodec * base_video_codec) ++{ ++ GstVideoFrame *frame; ++ ++ frame = g_malloc0 (sizeof (GstVideoFrame)); ++ ++ frame->system_frame_number = base_video_codec->system_frame_number; ++ base_video_codec->system_frame_number++; ++ ++ return frame; ++} ++ ++void ++gst_base_video_codec_free_frame (GstVideoFrame * frame) ++{ ++ if (frame->sink_buffer) { ++ gst_buffer_unref (frame->sink_buffer); ++ } ++#if 0 ++ if (frame->src_buffer) { ++ gst_buffer_unref (frame->src_buffer); ++ } ++#endif ++ ++ g_free (frame); ++} +diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideocodec.h schroedinger-1.0.8/gst-libs/gst/video/gstbasevideocodec.h +--- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideocodec.h 1970-01-01 01:00:00.000000000 +0100 ++++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideocodec.h 2009-09-11 17:35:39.000000000 +0200 +@@ -0,0 +1,150 @@ ++/* GStreamer ++ * Copyright (C) 2008 David Schleef ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library 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. ++ */ ++ ++#ifndef _GST_BASE_VIDEO_CODEC_H_ ++#define _GST_BASE_VIDEO_CODEC_H_ ++ ++#ifndef GST_USE_UNSTABLE_API ++#warning "GstBaseVideoCodec is unstable API and may change in future." ++#warning "You can define GST_USE_UNSTABLE_API to avoid this warning." ++#endif ++ ++#include ++#include ++ ++G_BEGIN_DECLS ++ ++#define GST_TYPE_BASE_VIDEO_CODEC \ ++ (gst_base_video_codec_get_type()) ++#define GST_BASE_VIDEO_CODEC(obj) \ ++ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_VIDEO_CODEC,GstBaseVideoCodec)) ++#define GST_BASE_VIDEO_CODEC_CLASS(klass) \ ++ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_VIDEO_CODEC,GstBaseVideoCodecClass)) ++#define GST_BASE_VIDEO_CODEC_GET_CLASS(obj) \ ++ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_VIDEO_CODEC,GstBaseVideoCodecClass)) ++#define GST_IS_BASE_VIDEO_CODEC(obj) \ ++ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_VIDEO_CODEC)) ++#define GST_IS_BASE_VIDEO_CODEC_CLASS(obj) \ ++ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_VIDEO_CODEC)) ++ ++/** ++ * GST_BASE_VIDEO_CODEC_SINK_NAME: ++ * ++ * The name of the templates for the sink pad. ++ */ ++#define GST_BASE_VIDEO_CODEC_SINK_NAME "sink" ++/** ++ * GST_BASE_VIDEO_CODEC_SRC_NAME: ++ * ++ * The name of the templates for the source pad. ++ */ ++#define GST_BASE_VIDEO_CODEC_SRC_NAME "src" ++ ++/** ++ * GST_BASE_VIDEO_CODEC_SRC_PAD: ++ * @obj: base video codec instance ++ * ++ * Gives the pointer to the source #GstPad object of the element. ++ */ ++#define GST_BASE_VIDEO_CODEC_SRC_PAD(obj) (((GstBaseVideoCodec *) (obj))->srcpad) ++ ++/** ++ * GST_BASE_VIDEO_CODEC_SINK_PAD: ++ * @obj: base video codec instance ++ * ++ * Gives the pointer to the sink #GstPad object of the element. ++ */ ++#define GST_BASE_VIDEO_CODEC_SINK_PAD(obj) (((GstBaseVideoCodec *) (obj))->sinkpad) ++ ++/** ++ * GST_BASE_VIDEO_CODEC_FLOW_NEED_DATA: ++ * ++ */ ++#define GST_BASE_VIDEO_CODEC_FLOW_NEED_DATA GST_FLOW_CUSTOM_SUCCESS ++ ++typedef struct _GstBaseVideoCodec GstBaseVideoCodec; ++typedef struct _GstBaseVideoCodecClass GstBaseVideoCodecClass; ++ ++struct _GstBaseVideoCodec ++{ ++ GstElement element; ++ ++ /*< private >*/ ++ GstPad *sinkpad; ++ GstPad *srcpad; ++ GstAdapter *input_adapter; ++ GstAdapter *output_adapter; ++ ++#if 0 ++ /* FIXME need to move from subclasses */ ++ GstVideoState state; ++#endif ++ ++ //int reorder_depth; ++ ++ //gboolean have_sync; ++ //gboolean discont; ++ //gboolean started; ++ ++ //GstVideoFrame *current_frame; ++ //int distance_from_sync; ++ ++ //gboolean sink_clipping; ++ ++ //guint64 presentation_frame_number; ++ guint64 system_frame_number; ++ ++ //GstCaps *caps; ++ //gboolean set_output_caps; ++ ++ //GstClockTime buffer_timestamp; ++ ++ GstClockTime timestamp_offset; ++}; ++ ++struct _GstBaseVideoCodecClass ++{ ++ GstElementClass element_class; ++ ++ gboolean (*start) (GstBaseVideoCodec *codec); ++ gboolean (*stop) (GstBaseVideoCodec *codec); ++ gboolean (*reset) (GstBaseVideoCodec *codec); ++ GstFlowReturn (*parse_data) (GstBaseVideoCodec *codec, gboolean at_eos); ++ int (*scan_for_sync) (GstAdapter *adapter, gboolean at_eos, ++ int offset, int n); ++ GstFlowReturn (*shape_output) (GstBaseVideoCodec *codec, GstVideoFrame *frame); ++ GstCaps *(*get_caps) (GstBaseVideoCodec *codec); ++ ++}; ++ ++GType gst_base_video_codec_get_type (void); ++ ++#if 0 ++guint64 gst_base_video_codec_get_timestamp (GstBaseVideoCodec *codec, ++ int picture_number); ++#endif ++ ++GstVideoFrame * gst_base_video_codec_new_frame (GstBaseVideoCodec *base_video_codec); ++void gst_base_video_codec_free_frame (GstVideoFrame *frame); ++ ++ ++G_END_DECLS ++ ++#endif ++ +diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideodecoder.c schroedinger-1.0.8/gst-libs/gst/video/gstbasevideodecoder.c +--- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideodecoder.c 1970-01-01 01:00:00.000000000 +0100 ++++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideodecoder.c 2009-10-12 12:23:39.000000000 +0200 +@@ -0,0 +1,1223 @@ ++/* GStreamer ++ * Copyright (C) 2008 David Schleef ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library 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. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include "gstbasevideodecoder.h" ++ ++#include ++ ++GST_DEBUG_CATEGORY_EXTERN (basevideo_debug); ++#define GST_CAT_DEFAULT basevideo_debug ++ ++static void gst_base_video_decoder_finalize (GObject * object); ++ ++static gboolean gst_base_video_decoder_sink_activate_push (GstPad * pad, ++ gboolean active); ++static gboolean gst_base_video_decoder_sink_setcaps (GstPad * pad, ++ GstCaps * caps); ++static gboolean gst_base_video_decoder_sink_event (GstPad * pad, ++ GstEvent * event); ++static gboolean gst_base_video_decoder_src_event (GstPad * pad, ++ GstEvent * event); ++static GstFlowReturn gst_base_video_decoder_chain (GstPad * pad, ++ GstBuffer * buf); ++static gboolean gst_base_video_decoder_sink_query (GstPad * pad, ++ GstQuery * query); ++static GstStateChangeReturn gst_base_video_decoder_change_state (GstElement * ++ element, GstStateChange transition); ++static const GstQueryType *gst_base_video_decoder_get_query_types (GstPad * ++ pad); ++static gboolean gst_base_video_decoder_src_query (GstPad * pad, ++ GstQuery * query); ++static gboolean gst_base_video_decoder_src_convert (GstPad * pad, ++ GstFormat src_format, gint64 src_value, GstFormat * dest_format, ++ gint64 * dest_value); ++static void gst_base_video_decoder_reset (GstBaseVideoDecoder * ++ base_video_decoder); ++ ++static guint64 ++gst_base_video_decoder_get_timestamp (GstBaseVideoDecoder * base_video_decoder, ++ int picture_number); ++static guint64 ++gst_base_video_decoder_get_field_timestamp (GstBaseVideoDecoder * ++ base_video_decoder, int field_offset); ++static GstVideoFrame *gst_base_video_decoder_new_frame (GstBaseVideoDecoder * ++ base_video_decoder); ++static void gst_base_video_decoder_free_frame (GstVideoFrame * frame); ++ ++GST_BOILERPLATE (GstBaseVideoDecoder, gst_base_video_decoder, ++ GstBaseVideoCodec, GST_TYPE_BASE_VIDEO_CODEC); ++ ++static void ++gst_base_video_decoder_base_init (gpointer g_class) ++{ ++ ++} ++ ++static void ++gst_base_video_decoder_class_init (GstBaseVideoDecoderClass * klass) ++{ ++ GObjectClass *gobject_class; ++ GstElementClass *gstelement_class; ++ ++ gobject_class = G_OBJECT_CLASS (klass); ++ gstelement_class = GST_ELEMENT_CLASS (klass); ++ ++ gobject_class->finalize = gst_base_video_decoder_finalize; ++ ++ gstelement_class->change_state = gst_base_video_decoder_change_state; ++ ++ parent_class = g_type_class_peek_parent (klass); ++} ++ ++static void ++gst_base_video_decoder_init (GstBaseVideoDecoder * base_video_decoder, ++ GstBaseVideoDecoderClass * klass) ++{ ++ GstPad *pad; ++ ++ GST_DEBUG ("gst_base_video_decoder_init"); ++ ++ pad = GST_BASE_VIDEO_CODEC_SINK_PAD (base_video_decoder); ++ ++ gst_pad_set_activatepush_function (pad, ++ gst_base_video_decoder_sink_activate_push); ++ gst_pad_set_chain_function (pad, gst_base_video_decoder_chain); ++ gst_pad_set_event_function (pad, gst_base_video_decoder_sink_event); ++ gst_pad_set_setcaps_function (pad, gst_base_video_decoder_sink_setcaps); ++ gst_pad_set_query_function (pad, gst_base_video_decoder_sink_query); ++ ++ pad = GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder); ++ ++ gst_pad_set_event_function (pad, gst_base_video_decoder_src_event); ++ gst_pad_set_query_type_function (pad, gst_base_video_decoder_get_query_types); ++ gst_pad_set_query_function (pad, gst_base_video_decoder_src_query); ++ ++ base_video_decoder->input_adapter = gst_adapter_new (); ++ base_video_decoder->output_adapter = gst_adapter_new (); ++ ++ gst_segment_init (&base_video_decoder->state.segment, GST_FORMAT_TIME); ++ gst_base_video_decoder_reset (base_video_decoder); ++ ++ base_video_decoder->current_frame = ++ gst_base_video_decoder_new_frame (base_video_decoder); ++ ++ base_video_decoder->sink_clipping = TRUE; ++} ++ ++static gboolean ++gst_base_video_decoder_sink_activate (GstBaseVideoDecoder * decoder, ++ gboolean active) ++{ ++ GstBaseVideoDecoderClass *klass; ++ gboolean result = FALSE; ++ ++ GST_DEBUG_OBJECT (decoder, "activate"); ++ ++ klass = GST_BASE_VIDEO_DECODER_GET_CLASS (decoder); ++ ++ if (active) { ++ if (klass->start) ++ result = klass->start (decoder); ++ } else { ++ /* We must make sure streaming has finished before resetting things ++ * and calling the ::stop vfunc */ ++ GST_PAD_STREAM_LOCK (GST_BASE_VIDEO_CODEC_SINK_PAD (decoder)); ++ GST_PAD_STREAM_UNLOCK (GST_BASE_VIDEO_CODEC_SINK_PAD (decoder)); ++ ++ if (klass->stop) ++ result = klass->stop (decoder); ++ } ++ ++ GST_DEBUG_OBJECT (decoder, "activate: %d", result); ++ ++ return result; ++} ++ ++static gboolean ++gst_base_video_decoder_sink_activate_push (GstPad * pad, gboolean active) ++{ ++ gboolean result = TRUE; ++ GstBaseVideoDecoder *base_video_decoder; ++ ++ base_video_decoder = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); ++ ++ result = gst_base_video_decoder_sink_activate (base_video_decoder, active); ++ ++ gst_object_unref (base_video_decoder); ++ ++ return result; ++} ++ ++static gboolean ++gst_base_video_decoder_sink_setcaps (GstPad * pad, GstCaps * caps) ++{ ++ GstBaseVideoDecoder *base_video_decoder; ++ GstBaseVideoDecoderClass *base_video_decoder_class; ++ GstStructure *structure; ++ const GValue *codec_data; ++ gboolean res = TRUE; ++ ++ base_video_decoder = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); ++ base_video_decoder_class = ++ GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); ++ ++ GST_DEBUG ("setcaps %" GST_PTR_FORMAT, caps); ++ ++ if (base_video_decoder->codec_data) { ++ gst_buffer_unref (base_video_decoder->codec_data); ++ base_video_decoder->codec_data = NULL; ++ } ++ ++ structure = gst_caps_get_structure (caps, 0); ++ ++ codec_data = gst_structure_get_value (structure, "codec_data"); ++ if (codec_data && G_VALUE_TYPE (codec_data) == GST_TYPE_BUFFER) { ++ base_video_decoder->codec_data = gst_value_get_buffer (codec_data); ++ } ++ ++ if (base_video_decoder_class->set_sink_caps) ++ res = base_video_decoder_class->set_sink_caps (base_video_decoder, caps); ++ ++ g_object_unref (base_video_decoder); ++ ++ return res; ++} ++ ++static void ++gst_base_video_decoder_finalize (GObject * object) ++{ ++ GstBaseVideoDecoder *base_video_decoder; ++ GstBaseVideoDecoderClass *base_video_decoder_class; ++ ++ g_return_if_fail (GST_IS_BASE_VIDEO_DECODER (object)); ++ base_video_decoder = GST_BASE_VIDEO_DECODER (object); ++ base_video_decoder_class = GST_BASE_VIDEO_DECODER_GET_CLASS (object); ++ ++ gst_base_video_decoder_reset (base_video_decoder); ++ ++ GST_DEBUG_OBJECT (object, "finalize"); ++ ++ G_OBJECT_CLASS (parent_class)->finalize (object); ++} ++ ++static gboolean ++gst_base_video_decoder_sink_event (GstPad * pad, GstEvent * event) ++{ ++ GstBaseVideoDecoder *base_video_decoder; ++ GstBaseVideoDecoderClass *base_video_decoder_class; ++ gboolean ret = FALSE; ++ ++ base_video_decoder = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); ++ base_video_decoder_class = ++ GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); ++ ++ switch (GST_EVENT_TYPE (event)) { ++ case GST_EVENT_EOS: ++ { ++ GstVideoFrame *frame; ++ ++ frame = g_malloc0 (sizeof (GstVideoFrame)); ++ frame->presentation_frame_number = ++ base_video_decoder->presentation_frame_number; ++ frame->presentation_duration = 0; ++ base_video_decoder->presentation_frame_number++; ++ ++ base_video_decoder->frames = ++ g_list_append (base_video_decoder->frames, frame); ++ if (base_video_decoder_class->finish) { ++ base_video_decoder_class->finish (base_video_decoder, frame); ++ } ++ ++ ret = ++ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), ++ event); ++ } ++ break; ++ case GST_EVENT_NEWSEGMENT: ++ { ++ gboolean update; ++ double rate; ++ double applied_rate; ++ GstFormat format; ++ gint64 start; ++ gint64 stop; ++ gint64 position; ++ ++ gst_event_parse_new_segment_full (event, &update, &rate, ++ &applied_rate, &format, &start, &stop, &position); ++ ++ if (format != GST_FORMAT_TIME) ++ goto newseg_wrong_format; ++ ++ gst_segment_set_newsegment_full (&base_video_decoder->state.segment, ++ update, rate, applied_rate, format, start, stop, position); ++ GST_DEBUG ("new segment %" GST_SEGMENT_FORMAT, ++ &base_video_decoder->state.segment); ++ ++ ret = ++ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), ++ event); ++ } ++ break; ++ default: ++ /* FIXME this changes the order of events */ ++ ret = ++ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), ++ event); ++ break; ++ } ++ ++done: ++ gst_object_unref (base_video_decoder); ++ return ret; ++ ++newseg_wrong_format: ++ { ++ GST_DEBUG_OBJECT (base_video_decoder, "received non TIME newsegment"); ++ gst_event_unref (event); ++ goto done; ++ } ++} ++ ++static gboolean ++gst_base_video_decoder_src_event (GstPad * pad, GstEvent * event) ++{ ++ GstBaseVideoDecoder *base_video_decoder; ++ gboolean res = FALSE; ++ ++ base_video_decoder = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); ++ ++ switch (GST_EVENT_TYPE (event)) { ++ case GST_EVENT_SEEK: ++ { ++ GstFormat format, tformat; ++ gdouble rate; ++ GstEvent *real_seek; ++ GstSeekFlags flags; ++ GstSeekType cur_type, stop_type; ++ gint64 cur, stop; ++ gint64 tcur, tstop; ++ ++ gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, ++ &cur, &stop_type, &stop); ++ gst_event_unref (event); ++ ++ tformat = GST_FORMAT_TIME; ++ res = ++ gst_base_video_decoder_src_convert (pad, format, cur, &tformat, ++ &tcur); ++ if (!res) ++ goto convert_error; ++ res = ++ gst_base_video_decoder_src_convert (pad, format, stop, &tformat, ++ &tstop); ++ if (!res) ++ goto convert_error; ++ ++ real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME, ++ flags, cur_type, tcur, stop_type, tstop); ++ ++ res = ++ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SINK_PAD ++ (base_video_decoder), real_seek); ++ ++ break; ++ } ++ case GST_EVENT_QOS: ++ { ++ gdouble proportion; ++ GstClockTimeDiff diff; ++ GstClockTime timestamp; ++ ++ gst_event_parse_qos (event, &proportion, &diff, ×tamp); ++ ++ GST_OBJECT_LOCK (base_video_decoder); ++ base_video_decoder->proportion = proportion; ++ base_video_decoder->earliest_time = timestamp + diff; ++ GST_OBJECT_UNLOCK (base_video_decoder); ++ ++ GST_DEBUG_OBJECT (base_video_decoder, ++ "got QoS %" GST_TIME_FORMAT ", %" G_GINT64_FORMAT ", %g", ++ GST_TIME_ARGS (timestamp), diff, proportion); ++ ++ res = ++ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SINK_PAD ++ (base_video_decoder), event); ++ break; ++ } ++ default: ++ res = ++ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SINK_PAD ++ (base_video_decoder), event); ++ break; ++ } ++done: ++ gst_object_unref (base_video_decoder); ++ return res; ++ ++convert_error: ++ GST_DEBUG_OBJECT (base_video_decoder, "could not convert format"); ++ goto done; ++} ++ ++ ++#if 0 ++static gboolean ++gst_base_video_decoder_sink_convert (GstPad * pad, ++ GstFormat src_format, gint64 src_value, ++ GstFormat * dest_format, gint64 * dest_value) ++{ ++ gboolean res = TRUE; ++ GstBaseVideoDecoder *enc; ++ ++ if (src_format == *dest_format) { ++ *dest_value = src_value; ++ return TRUE; ++ } ++ ++ enc = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); ++ ++ /* FIXME: check if we are in a decoding state */ ++ ++ switch (src_format) { ++ case GST_FORMAT_BYTES: ++ switch (*dest_format) { ++#if 0 ++ case GST_FORMAT_DEFAULT: ++ *dest_value = gst_util_uint64_scale_int (src_value, 1, ++ enc->bytes_per_picture); ++ break; ++#endif ++ case GST_FORMAT_TIME: ++ /* seems like a rather silly conversion, implement me if you like */ ++ default: ++ res = FALSE; ++ } ++ break; ++ case GST_FORMAT_DEFAULT: ++ switch (*dest_format) { ++ case GST_FORMAT_TIME: ++ *dest_value = gst_util_uint64_scale (src_value, ++ GST_SECOND * enc->fps_d, enc->fps_n); ++ break; ++#if 0 ++ case GST_FORMAT_BYTES: ++ *dest_value = gst_util_uint64_scale_int (src_value, ++ enc->bytes_per_picture, 1); ++ break; ++#endif ++ default: ++ res = FALSE; ++ } ++ break; ++ default: ++ res = FALSE; ++ break; ++ } ++} ++#endif ++ ++static gboolean ++gst_base_video_decoder_src_convert (GstPad * pad, ++ GstFormat src_format, gint64 src_value, ++ GstFormat * dest_format, gint64 * dest_value) ++{ ++ gboolean res = TRUE; ++ GstBaseVideoDecoder *enc; ++ ++ if (src_format == *dest_format) { ++ *dest_value = src_value; ++ return TRUE; ++ } ++ ++ enc = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); ++ ++ /* FIXME: check if we are in a encoding state */ ++ ++ GST_DEBUG ("src convert"); ++ switch (src_format) { ++#if 0 ++ case GST_FORMAT_DEFAULT: ++ switch (*dest_format) { ++ case GST_FORMAT_TIME: ++ *dest_value = gst_util_uint64_scale (granulepos_to_frame (src_value), ++ enc->fps_d * GST_SECOND, enc->fps_n); ++ break; ++ default: ++ res = FALSE; ++ } ++ break; ++ case GST_FORMAT_TIME: ++ switch (*dest_format) { ++ case GST_FORMAT_DEFAULT: ++ { ++ *dest_value = gst_util_uint64_scale (src_value, ++ enc->fps_n, enc->fps_d * GST_SECOND); ++ break; ++ } ++ default: ++ res = FALSE; ++ break; ++ } ++ break; ++#endif ++ default: ++ res = FALSE; ++ break; ++ } ++ ++ gst_object_unref (enc); ++ ++ return res; ++} ++ ++static const GstQueryType * ++gst_base_video_decoder_get_query_types (GstPad * pad) ++{ ++ static const GstQueryType query_types[] = { ++ GST_QUERY_CONVERT, ++ 0 ++ }; ++ ++ return query_types; ++} ++ ++static gboolean ++gst_base_video_decoder_src_query (GstPad * pad, GstQuery * query) ++{ ++ GstBaseVideoDecoder *enc; ++ gboolean res; ++ ++ enc = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); ++ ++ switch GST_QUERY_TYPE ++ (query) { ++ case GST_QUERY_CONVERT: ++ { ++ GstFormat src_fmt, dest_fmt; ++ gint64 src_val, dest_val; ++ ++ gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); ++ res = ++ gst_base_video_decoder_src_convert (pad, src_fmt, src_val, &dest_fmt, ++ &dest_val); ++ if (!res) ++ goto error; ++ gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); ++ break; ++ } ++ default: ++ res = gst_pad_query_default (pad, query); ++ } ++ gst_object_unref (enc); ++ return res; ++ ++error: ++ GST_DEBUG_OBJECT (enc, "query failed"); ++ gst_object_unref (enc); ++ return res; ++} ++ ++static gboolean ++gst_base_video_decoder_sink_query (GstPad * pad, GstQuery * query) ++{ ++ GstBaseVideoDecoder *base_video_decoder; ++ gboolean res = FALSE; ++ ++ base_video_decoder = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); ++ ++ GST_DEBUG_OBJECT (base_video_decoder, "sink query fps=%d/%d", ++ base_video_decoder->state.fps_n, base_video_decoder->state.fps_d); ++ switch (GST_QUERY_TYPE (query)) { ++ case GST_QUERY_CONVERT: ++ { ++ GstFormat src_fmt, dest_fmt; ++ gint64 src_val, dest_val; ++ ++ gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); ++ res = gst_base_video_rawvideo_convert (&base_video_decoder->state, ++ src_fmt, src_val, &dest_fmt, &dest_val); ++ if (!res) ++ goto error; ++ gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); ++ break; ++ } ++ default: ++ res = gst_pad_query_default (pad, query); ++ break; ++ } ++done: ++ gst_object_unref (base_video_decoder); ++ ++ return res; ++error: ++ GST_DEBUG_OBJECT (base_video_decoder, "query failed"); ++ goto done; ++} ++ ++ ++#if 0 ++static gboolean ++gst_pad_is_negotiated (GstPad * pad) ++{ ++ GstCaps *caps; ++ ++ g_return_val_if_fail (pad != NULL, FALSE); ++ ++ caps = gst_pad_get_negotiated_caps (pad); ++ if (caps) { ++ gst_caps_unref (caps); ++ return TRUE; ++ } ++ ++ return FALSE; ++} ++#endif ++ ++static void ++gst_base_video_decoder_reset (GstBaseVideoDecoder * base_video_decoder) ++{ ++ GstBaseVideoDecoderClass *base_video_decoder_class; ++ GList *g; ++ ++ base_video_decoder_class = ++ GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); ++ ++ GST_DEBUG ("reset"); ++ ++ base_video_decoder->started = FALSE; ++ ++ base_video_decoder->discont = TRUE; ++ base_video_decoder->have_sync = FALSE; ++ ++ base_video_decoder->timestamp_offset = GST_CLOCK_TIME_NONE; ++ base_video_decoder->system_frame_number = 0; ++ base_video_decoder->presentation_frame_number = 0; ++ base_video_decoder->last_sink_timestamp = GST_CLOCK_TIME_NONE; ++ base_video_decoder->last_sink_offset_end = GST_CLOCK_TIME_NONE; ++ base_video_decoder->base_picture_number = 0; ++ base_video_decoder->last_timestamp = GST_CLOCK_TIME_NONE; ++ ++ base_video_decoder->offset = 0; ++ ++ if (base_video_decoder->caps) { ++ gst_caps_unref (base_video_decoder->caps); ++ base_video_decoder->caps = NULL; ++ } ++ ++ if (base_video_decoder->current_frame) { ++ gst_base_video_decoder_free_frame (base_video_decoder->current_frame); ++ base_video_decoder->current_frame = NULL; ++ } ++ ++ base_video_decoder->have_src_caps = FALSE; ++ ++ for (g = g_list_first (base_video_decoder->frames); g; g = g_list_next (g)) { ++ GstVideoFrame *frame = g->data; ++ gst_base_video_decoder_free_frame (frame); ++ } ++ g_list_free (base_video_decoder->frames); ++ base_video_decoder->frames = NULL; ++ ++ if (base_video_decoder_class->reset) { ++ base_video_decoder_class->reset (base_video_decoder); ++ } ++} ++ ++static GstBuffer * ++gst_adapter_get_buffer (GstAdapter * adapter) ++{ ++ return gst_buffer_ref (GST_BUFFER (adapter->buflist->data)); ++ ++} ++ ++static GstFlowReturn ++gst_base_video_decoder_chain (GstPad * pad, GstBuffer * buf) ++{ ++ GstBaseVideoDecoder *base_video_decoder; ++ GstBaseVideoDecoderClass *klass; ++ GstBuffer *buffer; ++ GstFlowReturn ret; ++ ++ GST_DEBUG ("chain %" G_GINT64_FORMAT, GST_BUFFER_TIMESTAMP (buf)); ++ ++#if 0 ++ /* requiring the pad to be negotiated makes it impossible to use ++ * oggdemux or filesrc ! decoder */ ++ if (!gst_pad_is_negotiated (pad)) { ++ GST_DEBUG ("not negotiated"); ++ return GST_FLOW_NOT_NEGOTIATED; ++ } ++#endif ++ ++ base_video_decoder = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); ++ klass = GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); ++ ++ GST_DEBUG_OBJECT (base_video_decoder, "chain"); ++ ++ if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DISCONT))) { ++ GST_DEBUG_OBJECT (base_video_decoder, "received DISCONT buffer"); ++ if (base_video_decoder->started) { ++ gst_base_video_decoder_reset (base_video_decoder); ++ } ++ } ++ ++ if (!base_video_decoder->started) { ++ klass->start (base_video_decoder); ++ base_video_decoder->started = TRUE; ++ } ++ ++ if (GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) { ++ GST_DEBUG ("timestamp %" G_GINT64_FORMAT " offset %" G_GINT64_FORMAT, ++ GST_BUFFER_TIMESTAMP (buf), base_video_decoder->offset); ++ base_video_decoder->last_sink_timestamp = GST_BUFFER_TIMESTAMP (buf); ++ } ++ if (GST_BUFFER_OFFSET_END (buf) != -1) { ++ GST_DEBUG ("gp %" G_GINT64_FORMAT, GST_BUFFER_OFFSET_END (buf)); ++ base_video_decoder->last_sink_offset_end = GST_BUFFER_OFFSET_END (buf); ++ } ++ base_video_decoder->offset += GST_BUFFER_SIZE (buf); ++ ++#if 0 ++ if (base_video_decoder->timestamp_offset == GST_CLOCK_TIME_NONE && ++ GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) { ++ GST_DEBUG ("got new offset %lld", GST_BUFFER_TIMESTAMP (buf)); ++ base_video_decoder->timestamp_offset = GST_BUFFER_TIMESTAMP (buf); ++ } ++#endif ++ ++ if (base_video_decoder->current_frame == NULL) { ++ base_video_decoder->current_frame = ++ gst_base_video_decoder_new_frame (base_video_decoder); ++ } ++ ++ gst_adapter_push (base_video_decoder->input_adapter, buf); ++ ++ if (!base_video_decoder->have_sync) { ++ int n, m; ++ ++ GST_DEBUG ("no sync, scanning"); ++ ++ n = gst_adapter_available (base_video_decoder->input_adapter); ++ m = klass->scan_for_sync (base_video_decoder, FALSE, 0, n); ++ ++ if (m < 0) { ++ g_warning ("subclass returned negative scan %d", m); ++ } ++ ++ if (m >= n) { ++ g_warning ("subclass scanned past end %d >= %d", m, n); ++ } ++ ++ gst_adapter_flush (base_video_decoder->input_adapter, m); ++ ++ if (m < n) { ++ GST_DEBUG ("found possible sync after %d bytes (of %d)", m, n); ++ ++ /* this is only "maybe" sync */ ++ base_video_decoder->have_sync = TRUE; ++ } ++ ++ if (!base_video_decoder->have_sync) { ++ gst_object_unref (base_video_decoder); ++ return GST_FLOW_OK; ++ } ++ } ++ ++ /* FIXME: use gst_adapter_prev_timestamp() here instead? */ ++ buffer = gst_adapter_get_buffer (base_video_decoder->input_adapter); ++ ++ base_video_decoder->buffer_timestamp = GST_BUFFER_TIMESTAMP (buffer); ++ gst_buffer_unref (buffer); ++ ++ do { ++ ret = klass->parse_data (base_video_decoder, FALSE); ++ } while (ret == GST_FLOW_OK); ++ ++ if (ret == GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA) { ++ gst_object_unref (base_video_decoder); ++ return GST_FLOW_OK; ++ } ++ ++ gst_object_unref (base_video_decoder); ++ return ret; ++} ++ ++static GstStateChangeReturn ++gst_base_video_decoder_change_state (GstElement * element, ++ GstStateChange transition) ++{ ++ GstBaseVideoDecoder *base_video_decoder; ++ GstBaseVideoDecoderClass *base_video_decoder_class; ++ GstStateChangeReturn ret; ++ ++ base_video_decoder = GST_BASE_VIDEO_DECODER (element); ++ base_video_decoder_class = GST_BASE_VIDEO_DECODER_GET_CLASS (element); ++ ++ switch (transition) { ++ default: ++ break; ++ } ++ ++ ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); ++ ++ switch (transition) { ++ case GST_STATE_CHANGE_PAUSED_TO_READY: ++ break; ++ default: ++ break; ++ } ++ ++ return ret; ++} ++ ++static void ++gst_base_video_decoder_free_frame (GstVideoFrame * frame) ++{ ++ g_return_if_fail (frame != NULL); ++ ++ if (frame->sink_buffer) { ++ gst_buffer_unref (frame->sink_buffer); ++ } ++#if 0 ++ if (frame->src_buffer) { ++ gst_buffer_unref (frame->src_buffer); ++ } ++#endif ++ ++ g_free (frame); ++} ++ ++static GstVideoFrame * ++gst_base_video_decoder_new_frame (GstBaseVideoDecoder * base_video_decoder) ++{ ++ GstVideoFrame *frame; ++ ++ frame = g_malloc0 (sizeof (GstVideoFrame)); ++ ++ frame->system_frame_number = base_video_decoder->system_frame_number; ++ base_video_decoder->system_frame_number++; ++ ++ frame->decode_frame_number = frame->system_frame_number - ++ base_video_decoder->reorder_depth; ++ ++ frame->decode_timestamp = -1; ++ frame->presentation_timestamp = -1; ++ frame->presentation_duration = -1; ++ frame->n_fields = 2; ++ ++ return frame; ++} ++ ++GstFlowReturn ++gst_base_video_decoder_finish_frame (GstBaseVideoDecoder * base_video_decoder, ++ GstVideoFrame * frame) ++{ ++ GstBaseVideoDecoderClass *base_video_decoder_class; ++ GstBuffer *src_buffer; ++ ++ GST_DEBUG ("finish frame"); ++ ++ base_video_decoder_class = ++ GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); ++ ++ GST_DEBUG ("finish frame sync=%d pts=%" G_GINT64_FORMAT, frame->is_sync_point, ++ frame->presentation_timestamp); ++ ++ if (frame->is_sync_point) { ++ if (GST_CLOCK_TIME_IS_VALID (frame->presentation_timestamp)) { ++ if (frame->presentation_timestamp != base_video_decoder->timestamp_offset) { ++ GST_DEBUG ("sync timestamp %" G_GINT64_FORMAT " diff %" G_GINT64_FORMAT, ++ frame->presentation_timestamp, ++ frame->presentation_timestamp - ++ base_video_decoder->state.segment.start); ++ base_video_decoder->timestamp_offset = frame->presentation_timestamp; ++ base_video_decoder->field_index = 0; ++ } else { ++ /* This case is for one initial timestamp and no others, e.g., ++ * filesrc ! decoder ! xvimagesink */ ++ GST_WARNING ("sync timestamp didn't change, ignoring"); ++ frame->presentation_timestamp = GST_CLOCK_TIME_NONE; ++ } ++ } else { ++ GST_WARNING ("sync point doesn't have timestamp"); ++ if (GST_CLOCK_TIME_IS_VALID (base_video_decoder->timestamp_offset)) { ++ GST_ERROR ("No base timestamp. Assuming frames start at 0"); ++ base_video_decoder->timestamp_offset = 0; ++ base_video_decoder->field_index = 0; ++ } ++ } ++ } ++ frame->field_index = base_video_decoder->field_index; ++ base_video_decoder->field_index += frame->n_fields; ++ ++ if (frame->presentation_timestamp == GST_CLOCK_TIME_NONE) { ++ frame->presentation_timestamp = ++ gst_base_video_decoder_get_field_timestamp (base_video_decoder, ++ frame->field_index); ++ frame->presentation_duration = GST_CLOCK_TIME_NONE; ++ frame->decode_timestamp = ++ gst_base_video_decoder_get_timestamp (base_video_decoder, ++ frame->decode_frame_number); ++ } ++ if (frame->presentation_duration == GST_CLOCK_TIME_NONE) { ++ frame->presentation_duration = ++ gst_base_video_decoder_get_field_timestamp (base_video_decoder, ++ frame->field_index + frame->n_fields) - frame->presentation_timestamp; ++ } ++ ++ if (GST_CLOCK_TIME_IS_VALID (base_video_decoder->last_timestamp)) { ++ if (frame->presentation_timestamp < base_video_decoder->last_timestamp) { ++ GST_WARNING ("decreasing timestamp (%" G_GINT64_FORMAT " < %" ++ G_GINT64_FORMAT ")", frame->presentation_timestamp, ++ base_video_decoder->last_timestamp); ++ } ++ } ++ base_video_decoder->last_timestamp = frame->presentation_timestamp; ++ ++ GST_BUFFER_FLAG_UNSET (frame->src_buffer, GST_BUFFER_FLAG_DELTA_UNIT); ++ if (base_video_decoder->state.interlaced) { ++#ifndef GST_VIDEO_BUFFER_TFF ++#define GST_VIDEO_BUFFER_TFF (GST_MINI_OBJECT_FLAG_LAST << 5) ++#endif ++#ifndef GST_VIDEO_BUFFER_RFF ++#define GST_VIDEO_BUFFER_RFF (GST_MINI_OBJECT_FLAG_LAST << 6) ++#endif ++#ifndef GST_VIDEO_BUFFER_ONEFIELD ++#define GST_VIDEO_BUFFER_ONEFIELD (GST_MINI_OBJECT_FLAG_LAST << 7) ++#endif ++ int tff = base_video_decoder->state.top_field_first; ++ ++ if (frame->field_index & 1) { ++ tff ^= 1; ++ } ++ if (tff) { ++ GST_BUFFER_FLAG_SET (frame->src_buffer, GST_VIDEO_BUFFER_TFF); ++ } else { ++ GST_BUFFER_FLAG_UNSET (frame->src_buffer, GST_VIDEO_BUFFER_TFF); ++ } ++ GST_BUFFER_FLAG_UNSET (frame->src_buffer, GST_VIDEO_BUFFER_RFF); ++ GST_BUFFER_FLAG_UNSET (frame->src_buffer, GST_VIDEO_BUFFER_ONEFIELD); ++ if (frame->n_fields == 3) { ++ GST_BUFFER_FLAG_SET (frame->src_buffer, GST_VIDEO_BUFFER_RFF); ++ } else if (frame->n_fields == 1) { ++ GST_BUFFER_FLAG_UNSET (frame->src_buffer, GST_VIDEO_BUFFER_ONEFIELD); ++ } ++ } ++ ++ GST_BUFFER_TIMESTAMP (frame->src_buffer) = frame->presentation_timestamp; ++ GST_BUFFER_DURATION (frame->src_buffer) = frame->presentation_duration; ++ GST_BUFFER_OFFSET (frame->src_buffer) = -1; ++ GST_BUFFER_OFFSET_END (frame->src_buffer) = -1; ++ ++ GST_DEBUG ("pushing frame %" G_GINT64_FORMAT, frame->presentation_timestamp); ++ ++ base_video_decoder->frames = ++ g_list_remove (base_video_decoder->frames, frame); ++ ++ gst_base_video_decoder_set_src_caps (base_video_decoder); ++ ++ src_buffer = frame->src_buffer; ++ frame->src_buffer = NULL; ++ ++ gst_base_video_decoder_free_frame (frame); ++ ++ if (base_video_decoder->sink_clipping) { ++ gint64 start = GST_BUFFER_TIMESTAMP (src_buffer); ++ gint64 stop = GST_BUFFER_TIMESTAMP (src_buffer) + ++ GST_BUFFER_DURATION (src_buffer); ++ ++ if (gst_segment_clip (&base_video_decoder->state.segment, GST_FORMAT_TIME, ++ start, stop, &start, &stop)) { ++ GST_BUFFER_TIMESTAMP (src_buffer) = start; ++ GST_BUFFER_DURATION (src_buffer) = stop - start; ++ } else { ++ GST_DEBUG ("dropping buffer outside segment"); ++ gst_buffer_unref (src_buffer); ++ return GST_FLOW_OK; ++ } ++ } ++ ++ return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), ++ src_buffer); ++} ++ ++int ++gst_base_video_decoder_get_height (GstBaseVideoDecoder * base_video_decoder) ++{ ++ return base_video_decoder->state.height; ++} ++ ++int ++gst_base_video_decoder_get_width (GstBaseVideoDecoder * base_video_decoder) ++{ ++ return base_video_decoder->state.width; ++} ++ ++GstFlowReturn ++gst_base_video_decoder_end_of_stream (GstBaseVideoDecoder * base_video_decoder, ++ GstBuffer * buffer) ++{ ++ ++ if (base_video_decoder->frames) { ++ GST_DEBUG ("EOS with frames left over"); ++ } ++ ++ return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), ++ buffer); ++} ++ ++void ++gst_base_video_decoder_add_to_frame (GstBaseVideoDecoder * base_video_decoder, ++ int n_bytes) ++{ ++ GstBuffer *buf; ++ ++ GST_DEBUG ("add to frame"); ++ ++#if 0 ++ if (gst_adapter_available (base_video_decoder->output_adapter) == 0) { ++ GstBuffer *buffer; ++ ++ buffer = ++ gst_adapter_get_orig_buffer_at_offset ++ (base_video_decoder->input_adapter, 0); ++ if (buffer) { ++ base_video_decoder->current_frame->presentation_timestamp = ++ GST_BUFFER_TIMESTAMP (buffer); ++ gst_buffer_unref (buffer); ++ } ++ } ++#endif ++ ++ if (n_bytes == 0) ++ return; ++ ++ buf = gst_adapter_take_buffer (base_video_decoder->input_adapter, n_bytes); ++ ++ gst_adapter_push (base_video_decoder->output_adapter, buf); ++} ++ ++static guint64 ++gst_base_video_decoder_get_timestamp (GstBaseVideoDecoder * base_video_decoder, ++ int picture_number) ++{ ++ if (base_video_decoder->state.fps_d == 0) { ++ return -1; ++ } ++ if (picture_number < base_video_decoder->base_picture_number) { ++ return base_video_decoder->timestamp_offset - ++ (gint64) gst_util_uint64_scale (base_video_decoder->base_picture_number ++ - picture_number, base_video_decoder->state.fps_d * GST_SECOND, ++ base_video_decoder->state.fps_n); ++ } else { ++ return base_video_decoder->timestamp_offset + ++ gst_util_uint64_scale (picture_number - ++ base_video_decoder->base_picture_number, ++ base_video_decoder->state.fps_d * GST_SECOND, ++ base_video_decoder->state.fps_n); ++ } ++} ++ ++static guint64 ++gst_base_video_decoder_get_field_timestamp (GstBaseVideoDecoder * ++ base_video_decoder, int field_offset) ++{ ++ if (base_video_decoder->state.fps_d == 0) { ++ return GST_CLOCK_TIME_NONE; ++ } ++ if (field_offset < 0) { ++ GST_WARNING ("field offset < 0"); ++ return GST_CLOCK_TIME_NONE; ++ } ++ return base_video_decoder->timestamp_offset + ++ gst_util_uint64_scale (field_offset, ++ base_video_decoder->state.fps_d * GST_SECOND, ++ base_video_decoder->state.fps_n * 2); ++} ++ ++ ++GstFlowReturn ++gst_base_video_decoder_have_frame (GstBaseVideoDecoder * base_video_decoder) ++{ ++ GstVideoFrame *frame = base_video_decoder->current_frame; ++ GstBuffer *buffer; ++ GstBaseVideoDecoderClass *base_video_decoder_class; ++ GstFlowReturn ret = GST_FLOW_OK; ++ int n_available; ++ ++ GST_DEBUG ("have_frame"); ++ ++ base_video_decoder_class = ++ GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); ++ ++ n_available = gst_adapter_available (base_video_decoder->output_adapter); ++ if (n_available) { ++ buffer = gst_adapter_take_buffer (base_video_decoder->output_adapter, ++ n_available); ++ } else { ++ buffer = gst_buffer_new_and_alloc (0); ++ } ++ ++ frame->distance_from_sync = base_video_decoder->distance_from_sync; ++ base_video_decoder->distance_from_sync++; ++ ++#if 0 ++ if (frame->presentation_timestamp == GST_CLOCK_TIME_NONE) { ++ frame->presentation_timestamp = ++ gst_base_video_decoder_get_timestamp (base_video_decoder, ++ frame->presentation_frame_number); ++ frame->presentation_duration = ++ gst_base_video_decoder_get_timestamp (base_video_decoder, ++ frame->presentation_frame_number + 1) - frame->presentation_timestamp; ++ frame->decode_timestamp = ++ gst_base_video_decoder_get_timestamp (base_video_decoder, ++ frame->decode_frame_number); ++ } ++#endif ++ ++#if 0 ++ GST_BUFFER_TIMESTAMP (buffer) = frame->presentation_timestamp; ++ GST_BUFFER_DURATION (buffer) = frame->presentation_duration; ++ if (frame->decode_frame_number < 0) { ++ GST_BUFFER_OFFSET (buffer) = 0; ++ } else { ++ GST_BUFFER_OFFSET (buffer) = frame->decode_timestamp; ++ } ++ GST_BUFFER_OFFSET_END (buffer) = GST_CLOCK_TIME_NONE; ++#endif ++ ++ GST_DEBUG ("pts %" GST_TIME_FORMAT, ++ GST_TIME_ARGS (frame->presentation_timestamp)); ++ GST_DEBUG ("dts %" GST_TIME_FORMAT, GST_TIME_ARGS (frame->decode_timestamp)); ++ GST_DEBUG ("dist %d", frame->distance_from_sync); ++ ++ if (frame->is_sync_point) { ++ GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DELTA_UNIT); ++ } else { ++ GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT); ++ } ++ if (base_video_decoder->discont) { ++ GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT); ++ base_video_decoder->discont = FALSE; ++ } ++ ++ frame->sink_buffer = buffer; ++ ++ base_video_decoder->frames = g_list_append (base_video_decoder->frames, ++ frame); ++ ++ /* do something with frame */ ++ ret = base_video_decoder_class->handle_frame (base_video_decoder, frame); ++ if (!GST_FLOW_IS_SUCCESS (ret)) { ++ GST_DEBUG ("flow error!"); ++ } ++ ++ /* create new frame */ ++ base_video_decoder->current_frame = ++ gst_base_video_decoder_new_frame (base_video_decoder); ++ ++ return ret; ++} ++ ++GstVideoState * ++gst_base_video_decoder_get_state (GstBaseVideoDecoder * base_video_decoder) ++{ ++ return &base_video_decoder->state; ++ ++} ++ ++void ++gst_base_video_decoder_set_state (GstBaseVideoDecoder * base_video_decoder, ++ GstVideoState * state) ++{ ++ memcpy (&base_video_decoder->state, state, sizeof (*state)); ++ ++} ++ ++void ++gst_base_video_decoder_lost_sync (GstBaseVideoDecoder * base_video_decoder) ++{ ++ g_return_if_fail (GST_IS_BASE_VIDEO_DECODER (base_video_decoder)); ++ ++ GST_DEBUG ("lost_sync"); ++ ++ if (gst_adapter_available (base_video_decoder->input_adapter) >= 1) { ++ gst_adapter_flush (base_video_decoder->input_adapter, 1); ++ } ++ ++ base_video_decoder->have_sync = FALSE; ++} ++ ++void ++gst_base_video_decoder_set_sync_point (GstBaseVideoDecoder * base_video_decoder) ++{ ++ GST_DEBUG ("set_sync_point"); ++ ++ base_video_decoder->current_frame->is_sync_point = TRUE; ++ base_video_decoder->distance_from_sync = 0; ++ ++ base_video_decoder->current_frame->presentation_timestamp = ++ base_video_decoder->last_sink_timestamp; ++ ++ ++} ++ ++GstVideoFrame * ++gst_base_video_decoder_get_frame (GstBaseVideoDecoder * base_video_decoder, ++ int frame_number) ++{ ++ GList *g; ++ ++ for (g = g_list_first (base_video_decoder->frames); g; g = g_list_next (g)) { ++ GstVideoFrame *frame = g->data; ++ ++ if (frame->system_frame_number == frame_number) { ++ return frame; ++ } ++ } ++ ++ return NULL; ++} ++ ++void ++gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder) ++{ ++ GstCaps *caps; ++ GstVideoState *state = &base_video_decoder->state; ++ ++ if (base_video_decoder->have_src_caps) ++ return; ++ ++ caps = gst_video_format_new_caps (state->format, ++ state->width, state->height, ++ state->fps_n, state->fps_d, state->par_n, state->par_d); ++ gst_caps_set_simple (caps, "interlaced", ++ G_TYPE_BOOLEAN, state->interlaced, NULL); ++ ++ GST_DEBUG ("setting caps %" GST_PTR_FORMAT, caps); ++ ++ gst_pad_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), caps); ++ ++ base_video_decoder->have_src_caps = TRUE; ++} +diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideodecoder.h schroedinger-1.0.8/gst-libs/gst/video/gstbasevideodecoder.h +--- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideodecoder.h 1970-01-01 01:00:00.000000000 +0100 ++++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideodecoder.h 2009-10-12 12:23:39.000000000 +0200 +@@ -0,0 +1,163 @@ ++/* GStreamer ++ * Copyright (C) 2008 David Schleef ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library 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. ++ */ ++ ++#ifndef _GST_BASE_VIDEO_DECODER_H_ ++#define _GST_BASE_VIDEO_DECODER_H_ ++ ++#ifndef GST_USE_UNSTABLE_API ++#warning "GstBaseVideoDecoder is unstable API and may change in future." ++#warning "You can define GST_USE_UNSTABLE_API to avoid this warning." ++#endif ++ ++#include ++ ++G_BEGIN_DECLS ++ ++#define GST_TYPE_BASE_VIDEO_DECODER \ ++ (gst_base_video_decoder_get_type()) ++#define GST_BASE_VIDEO_DECODER(obj) \ ++ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_VIDEO_DECODER,GstBaseVideoDecoder)) ++#define GST_BASE_VIDEO_DECODER_CLASS(klass) \ ++ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_VIDEO_DECODER,GstBaseVideoDecoderClass)) ++#define GST_BASE_VIDEO_DECODER_GET_CLASS(obj) \ ++ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_VIDEO_DECODER,GstBaseVideoDecoderClass)) ++#define GST_IS_BASE_VIDEO_DECODER(obj) \ ++ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_VIDEO_DECODER)) ++#define GST_IS_BASE_VIDEO_DECODER_CLASS(obj) \ ++ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_VIDEO_DECODER)) ++ ++/** ++ * GST_BASE_VIDEO_DECODER_SINK_NAME: ++ * ++ * The name of the templates for the sink pad. ++ */ ++#define GST_BASE_VIDEO_DECODER_SINK_NAME "sink" ++/** ++ * GST_BASE_VIDEO_DECODER_SRC_NAME: ++ * ++ * The name of the templates for the source pad. ++ */ ++#define GST_BASE_VIDEO_DECODER_SRC_NAME "src" ++ ++/** ++ * GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA: ++ * ++ * Custom GstFlowReturn value indicating that more data is needed. ++ */ ++#define GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA GST_FLOW_CUSTOM_SUCCESS ++ ++ ++typedef struct _GstBaseVideoDecoder GstBaseVideoDecoder; ++typedef struct _GstBaseVideoDecoderClass GstBaseVideoDecoderClass; ++ ++struct _GstBaseVideoDecoder ++{ ++ GstBaseVideoCodec base_video_codec; ++ ++ /*< private >*/ ++ GstAdapter *input_adapter; ++ GstAdapter *output_adapter; ++ ++ GList *frames; ++ ++ gboolean have_sync; ++ gboolean discont; ++ gboolean started; ++ ++ GstVideoState state; ++ ++ gboolean sink_clipping; ++ ++ guint64 presentation_frame_number; ++ guint64 system_frame_number; ++ ++ GstCaps *caps; ++ gboolean have_src_caps; ++ ++ GstVideoFrame *current_frame; ++ ++ int distance_from_sync; ++ int reorder_depth; ++ ++ GstClockTime buffer_timestamp; ++ ++ GstClockTime timestamp_offset; ++ ++ gdouble proportion; ++ GstClockTime earliest_time; ++ ++ GstBuffer *codec_data; ++ ++ guint64 offset; ++ GstClockTime last_timestamp; ++ ++ GstClockTime last_sink_timestamp; ++ GstClockTime last_sink_offset_end; ++ guint64 base_picture_number; ++ ++ int field_index; ++}; ++ ++struct _GstBaseVideoDecoderClass ++{ ++ GstBaseVideoCodecClass base_video_codec_class; ++ ++ gboolean (*set_sink_caps) (GstBaseVideoDecoder *coder, GstCaps *caps); ++ gboolean (*start) (GstBaseVideoDecoder *coder); ++ gboolean (*stop) (GstBaseVideoDecoder *coder); ++ gboolean (*reset) (GstBaseVideoDecoder *coder); ++ int (*scan_for_sync) (GstBaseVideoDecoder *decoder, gboolean at_eos, ++ int offset, int n); ++ GstFlowReturn (*parse_data) (GstBaseVideoDecoder *decoder, gboolean at_eos); ++ gboolean (*finish) (GstBaseVideoDecoder *coder, GstVideoFrame *frame); ++ GstFlowReturn (*handle_frame) (GstBaseVideoDecoder *coder, GstVideoFrame *frame); ++ GstFlowReturn (*shape_output) (GstBaseVideoDecoder *coder, GstVideoFrame *frame); ++ GstCaps *(*get_caps) (GstBaseVideoDecoder *coder); ++}; ++ ++GType gst_base_video_decoder_get_type (void); ++ ++int gst_base_video_decoder_get_width (GstBaseVideoDecoder *coder); ++int gst_base_video_decoder_get_height (GstBaseVideoDecoder *coder); ++ ++guint64 gst_base_video_decoder_get_timestamp_offset (GstBaseVideoDecoder *coder); ++ ++GstVideoFrame *gst_base_video_decoder_get_frame (GstBaseVideoDecoder *coder, ++ int frame_number); ++void gst_base_video_decoder_add_to_frame (GstBaseVideoDecoder *base_video_decoder, ++ int n_bytes); ++GstFlowReturn gst_base_video_decoder_finish_frame (GstBaseVideoDecoder *base_video_decoder, ++ GstVideoFrame *frame); ++GstFlowReturn gst_base_video_decoder_end_of_stream (GstBaseVideoDecoder *base_video_decoder, ++ GstBuffer *buffer); ++GstFlowReturn ++gst_base_video_decoder_have_frame (GstBaseVideoDecoder *base_video_decoder); ++GstVideoState * gst_base_video_decoder_get_state (GstBaseVideoDecoder *base_video_decoder); ++void gst_base_video_decoder_set_state (GstBaseVideoDecoder *base_video_decoder, ++ GstVideoState *state); ++void gst_base_video_decoder_lost_sync (GstBaseVideoDecoder *base_video_decoder); ++void gst_base_video_decoder_set_sync_point (GstBaseVideoDecoder *base_video_decoder); ++ ++void gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder *base_video_decoder); ++ ++ ++G_END_DECLS ++ ++#endif ++ +diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoencoder.c schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoencoder.c +--- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoencoder.c 1970-01-01 01:00:00.000000000 +0100 ++++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoencoder.c 2009-10-12 12:23:39.000000000 +0200 +@@ -0,0 +1,521 @@ ++/* GStreamer ++ * Copyright (C) 2008 David Schleef ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library 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. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include "gstbasevideoencoder.h" ++#include "gstbasevideoutils.h" ++ ++GST_DEBUG_CATEGORY_EXTERN (basevideo_debug); ++#define GST_CAT_DEFAULT basevideo_debug ++ ++static void gst_base_video_encoder_finalize (GObject * object); ++ ++static gboolean gst_base_video_encoder_sink_setcaps (GstPad * pad, ++ GstCaps * caps); ++static gboolean gst_base_video_encoder_sink_event (GstPad * pad, ++ GstEvent * event); ++static GstFlowReturn gst_base_video_encoder_chain (GstPad * pad, ++ GstBuffer * buf); ++static GstStateChangeReturn gst_base_video_encoder_change_state (GstElement * ++ element, GstStateChange transition); ++static const GstQueryType *gst_base_video_encoder_get_query_types (GstPad * ++ pad); ++static gboolean gst_base_video_encoder_src_query (GstPad * pad, ++ GstQuery * query); ++ ++static void ++_do_init (GType object_type) ++{ ++ const GInterfaceInfo preset_interface_info = { ++ NULL, /* interface_init */ ++ NULL, /* interface_finalize */ ++ NULL /* interface_data */ ++ }; ++ ++ g_type_add_interface_static (object_type, GST_TYPE_PRESET, ++ &preset_interface_info); ++} ++ ++GST_BOILERPLATE_FULL (GstBaseVideoEncoder, gst_base_video_encoder, ++ GstBaseVideoCodec, GST_TYPE_BASE_VIDEO_CODEC, _do_init); ++ ++static void ++gst_base_video_encoder_base_init (gpointer g_class) ++{ ++ ++} ++ ++static void ++gst_base_video_encoder_class_init (GstBaseVideoEncoderClass * klass) ++{ ++ GObjectClass *gobject_class; ++ GstElementClass *gstelement_class; ++ ++ gobject_class = G_OBJECT_CLASS (klass); ++ gstelement_class = GST_ELEMENT_CLASS (klass); ++ ++ gobject_class->finalize = gst_base_video_encoder_finalize; ++ ++ gstelement_class->change_state = gst_base_video_encoder_change_state; ++ ++ parent_class = g_type_class_peek_parent (klass); ++} ++ ++static void ++gst_base_video_encoder_init (GstBaseVideoEncoder * base_video_encoder, ++ GstBaseVideoEncoderClass * klass) ++{ ++ GstPad *pad; ++ ++ GST_DEBUG ("gst_base_video_encoder_init"); ++ ++ pad = GST_BASE_VIDEO_CODEC_SINK_PAD (base_video_encoder); ++ ++ gst_pad_set_chain_function (pad, gst_base_video_encoder_chain); ++ gst_pad_set_event_function (pad, gst_base_video_encoder_sink_event); ++ gst_pad_set_setcaps_function (pad, gst_base_video_encoder_sink_setcaps); ++ ++ pad = GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder); ++ ++ gst_pad_set_query_type_function (pad, gst_base_video_encoder_get_query_types); ++ gst_pad_set_query_function (pad, gst_base_video_encoder_src_query); ++} ++ ++static gboolean ++gst_base_video_encoder_sink_setcaps (GstPad * pad, GstCaps * caps) ++{ ++ GstBaseVideoEncoder *base_video_encoder; ++ GstBaseVideoEncoderClass *base_video_encoder_class; ++ gboolean res; ++ ++ base_video_encoder = GST_BASE_VIDEO_ENCODER (gst_pad_get_parent (pad)); ++ base_video_encoder_class = ++ GST_BASE_VIDEO_ENCODER_GET_CLASS (base_video_encoder); ++ ++ GST_DEBUG ("setcaps"); ++ ++ gst_base_video_state_from_caps (&base_video_encoder->state, caps); ++ ++ res = base_video_encoder_class->set_format (base_video_encoder, ++ &base_video_encoder->state); ++ ++ base_video_encoder_class->start (base_video_encoder); ++ ++ g_object_unref (base_video_encoder); ++ ++ return res; ++} ++ ++static void ++gst_base_video_encoder_finalize (GObject * object) ++{ ++ GstBaseVideoEncoder *base_video_encoder; ++ GstBaseVideoEncoderClass *base_video_encoder_class; ++ ++ g_return_if_fail (GST_IS_BASE_VIDEO_ENCODER (object)); ++ base_video_encoder = GST_BASE_VIDEO_ENCODER (object); ++ base_video_encoder_class = GST_BASE_VIDEO_ENCODER_GET_CLASS (object); ++ ++ GST_DEBUG ("finalize"); ++ ++ G_OBJECT_CLASS (parent_class)->finalize (object); ++} ++ ++static gboolean ++gst_base_video_encoder_sink_event (GstPad * pad, GstEvent * event) ++{ ++ GstBaseVideoEncoder *base_video_encoder; ++ GstBaseVideoEncoderClass *base_video_encoder_class; ++ gboolean ret = FALSE; ++ ++ base_video_encoder = GST_BASE_VIDEO_ENCODER (gst_pad_get_parent (pad)); ++ base_video_encoder_class = ++ GST_BASE_VIDEO_ENCODER_GET_CLASS (base_video_encoder); ++ ++ switch (GST_EVENT_TYPE (event)) { ++ case GST_EVENT_EOS: ++ { ++ GstVideoFrame *frame; ++ ++ frame = g_malloc0 (sizeof (GstVideoFrame)); ++ frame->presentation_frame_number = ++ base_video_encoder->presentation_frame_number; ++ frame->presentation_duration = 0; ++ frame->is_eos = TRUE; ++ base_video_encoder->presentation_frame_number++; ++ ++ base_video_encoder->frames = ++ g_list_append (base_video_encoder->frames, frame); ++ base_video_encoder_class->finish (base_video_encoder, frame); ++ ++ ret = ++ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), ++ event); ++ } ++ break; ++ case GST_EVENT_NEWSEGMENT: ++ { ++ gboolean update; ++ double rate; ++ double applied_rate; ++ GstFormat format; ++ gint64 start; ++ gint64 stop; ++ gint64 position; ++ ++ gst_event_parse_new_segment_full (event, &update, &rate, ++ &applied_rate, &format, &start, &stop, &position); ++ ++ if (format != GST_FORMAT_TIME) ++ goto newseg_wrong_format; ++ ++ GST_DEBUG ("new segment %" G_GINT64_FORMAT " %" G_GINT64_FORMAT, start, ++ position); ++ ++ gst_segment_set_newsegment_full (&base_video_encoder->state.segment, ++ update, rate, applied_rate, format, start, stop, position); ++ ++ ret = ++ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), ++ event); ++ } ++ break; ++ default: ++ /* FIXME this changes the order of events */ ++ ret = ++ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), ++ event); ++ break; ++ } ++ ++done: ++ gst_object_unref (base_video_encoder); ++ return ret; ++ ++newseg_wrong_format: ++ { ++ GST_DEBUG_OBJECT (base_video_encoder, "received non TIME newsegment"); ++ gst_event_unref (event); ++ goto done; ++ } ++} ++ ++static const GstQueryType * ++gst_base_video_encoder_get_query_types (GstPad * pad) ++{ ++ static const GstQueryType query_types[] = { ++ GST_QUERY_CONVERT, ++ GST_QUERY_LATENCY, ++ 0 ++ }; ++ ++ return query_types; ++} ++ ++static gboolean ++gst_base_video_encoder_src_query (GstPad * pad, GstQuery * query) ++{ ++ GstBaseVideoEncoder *enc; ++ gboolean res; ++ GstPad *peerpad; ++ ++ enc = GST_BASE_VIDEO_ENCODER (gst_pad_get_parent (pad)); ++ peerpad = gst_pad_get_peer (GST_BASE_VIDEO_CODEC_SINK_PAD (enc)); ++ ++ switch GST_QUERY_TYPE ++ (query) { ++ case GST_QUERY_CONVERT: ++ { ++ GstFormat src_fmt, dest_fmt; ++ gint64 src_val, dest_val; ++ ++ gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); ++ res = ++ gst_base_video_encoded_video_convert (&enc->state, src_fmt, src_val, ++ &dest_fmt, &dest_val); ++ if (!res) ++ goto error; ++ gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); ++ break; ++ } ++ case GST_QUERY_LATENCY: ++ { ++ gboolean live; ++ GstClockTime min_latency, max_latency; ++ ++ res = gst_pad_query (peerpad, query); ++ if (res) { ++ gst_query_parse_latency (query, &live, &min_latency, &max_latency); ++ ++ min_latency += enc->min_latency; ++ if (max_latency != GST_CLOCK_TIME_NONE) { ++ max_latency += enc->max_latency; ++ } ++ ++ gst_query_set_latency (query, live, min_latency, max_latency); ++ } ++ } ++ break; ++ default: ++ res = gst_pad_query_default (pad, query); ++ } ++ gst_object_unref (peerpad); ++ gst_object_unref (enc); ++ return res; ++ ++error: ++ GST_DEBUG_OBJECT (enc, "query failed"); ++ gst_object_unref (peerpad); ++ gst_object_unref (enc); ++ return res; ++} ++ ++static gboolean ++gst_pad_is_negotiated (GstPad * pad) ++{ ++ GstCaps *caps; ++ ++ g_return_val_if_fail (pad != NULL, FALSE); ++ ++ caps = gst_pad_get_negotiated_caps (pad); ++ if (caps) { ++ gst_caps_unref (caps); ++ return TRUE; ++ } ++ ++ return FALSE; ++} ++ ++static GstFlowReturn ++gst_base_video_encoder_chain (GstPad * pad, GstBuffer * buf) ++{ ++ GstBaseVideoEncoder *base_video_encoder; ++ GstBaseVideoEncoderClass *klass; ++ GstVideoFrame *frame; ++ GstFlowReturn ret = GST_FLOW_OK; ++ ++ if (!gst_pad_is_negotiated (pad)) { ++ return GST_FLOW_NOT_NEGOTIATED; ++ } ++ ++ base_video_encoder = GST_BASE_VIDEO_ENCODER (gst_pad_get_parent (pad)); ++ klass = GST_BASE_VIDEO_ENCODER_GET_CLASS (base_video_encoder); ++ ++ if (base_video_encoder->sink_clipping) { ++ gint64 start = GST_BUFFER_TIMESTAMP (buf); ++ gint64 stop = start + GST_BUFFER_DURATION (buf); ++ gint64 clip_start; ++ gint64 clip_stop; ++ ++ if (!gst_segment_clip (&base_video_encoder->state.segment, ++ GST_FORMAT_TIME, start, stop, &clip_start, &clip_stop)) { ++ GST_DEBUG ("clipping to segment dropped frame"); ++ goto done; ++ } ++ } ++ ++ frame = g_malloc0 (sizeof (GstVideoFrame)); ++ frame->sink_buffer = buf; ++ frame->presentation_timestamp = GST_BUFFER_TIMESTAMP (buf); ++ frame->presentation_duration = GST_BUFFER_DURATION (buf); ++ frame->presentation_frame_number = ++ base_video_encoder->presentation_frame_number; ++ base_video_encoder->presentation_frame_number++; ++ ++ base_video_encoder->frames = ++ g_list_append (base_video_encoder->frames, frame); ++ ++ ret = klass->handle_frame (base_video_encoder, frame); ++ ++done: ++ g_object_unref (base_video_encoder); ++ ++ return ret; ++} ++ ++static GstStateChangeReturn ++gst_base_video_encoder_change_state (GstElement * element, ++ GstStateChange transition) ++{ ++ GstBaseVideoEncoder *base_video_encoder; ++ GstBaseVideoEncoderClass *base_video_encoder_class; ++ GstStateChangeReturn ret; ++ ++ base_video_encoder = GST_BASE_VIDEO_ENCODER (element); ++ base_video_encoder_class = GST_BASE_VIDEO_ENCODER_GET_CLASS (element); ++ ++ switch (transition) { ++ default: ++ break; ++ } ++ ++ ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); ++ ++ switch (transition) { ++ case GST_STATE_CHANGE_PAUSED_TO_READY: ++ if (base_video_encoder_class->stop) { ++ base_video_encoder_class->stop (base_video_encoder); ++ } ++ break; ++ default: ++ break; ++ } ++ ++ return ret; ++} ++ ++GstFlowReturn ++gst_base_video_encoder_finish_frame (GstBaseVideoEncoder * base_video_encoder, ++ GstVideoFrame * frame) ++{ ++ GstFlowReturn ret; ++ GstBaseVideoEncoderClass *base_video_encoder_class; ++ ++ base_video_encoder_class = ++ GST_BASE_VIDEO_ENCODER_GET_CLASS (base_video_encoder); ++ ++ frame->system_frame_number = base_video_encoder->system_frame_number; ++ base_video_encoder->system_frame_number++; ++ ++ if (frame->is_sync_point) { ++ base_video_encoder->distance_from_sync = 0; ++ GST_BUFFER_FLAG_UNSET (frame->src_buffer, GST_BUFFER_FLAG_DELTA_UNIT); ++ } else { ++ GST_BUFFER_FLAG_SET (frame->src_buffer, GST_BUFFER_FLAG_DELTA_UNIT); ++ } ++ ++ frame->distance_from_sync = base_video_encoder->distance_from_sync; ++ base_video_encoder->distance_from_sync++; ++ ++ frame->decode_frame_number = frame->system_frame_number - 1; ++ if (frame->decode_frame_number < 0) { ++ frame->decode_timestamp = 0; ++ } else { ++ frame->decode_timestamp = gst_util_uint64_scale (frame->decode_frame_number, ++ GST_SECOND * base_video_encoder->state.fps_d, ++ base_video_encoder->state.fps_n); ++ } ++ ++ GST_BUFFER_TIMESTAMP (frame->src_buffer) = frame->presentation_timestamp; ++ GST_BUFFER_DURATION (frame->src_buffer) = frame->presentation_duration; ++ GST_BUFFER_OFFSET (frame->src_buffer) = frame->decode_timestamp; ++ ++ base_video_encoder->frames = ++ g_list_remove (base_video_encoder->frames, frame); ++ ++ if (!base_video_encoder->set_output_caps) { ++ GstCaps *caps; ++ ++ if (base_video_encoder_class->get_caps) { ++ caps = base_video_encoder_class->get_caps (base_video_encoder); ++ } else { ++ caps = gst_caps_new_simple ("video/unknown", NULL); ++ } ++ base_video_encoder->caps = gst_caps_ref (caps); ++ gst_pad_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), caps); ++ base_video_encoder->set_output_caps = TRUE; ++ } ++ ++ if (base_video_encoder_class->shape_output) { ++ ret = base_video_encoder_class->shape_output (base_video_encoder, frame); ++ } else { ++ ret = ++ gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), ++ frame->src_buffer); ++ } ++ ++ gst_base_video_codec_free_frame (frame); ++ ++ return ret; ++} ++ ++int ++gst_base_video_encoder_get_height (GstBaseVideoEncoder * base_video_encoder) ++{ ++ return base_video_encoder->state.height; ++} ++ ++int ++gst_base_video_encoder_get_width (GstBaseVideoEncoder * base_video_encoder) ++{ ++ return base_video_encoder->state.width; ++} ++ ++const GstVideoState * ++gst_base_video_encoder_get_state (GstBaseVideoEncoder * base_video_encoder) ++{ ++ return &base_video_encoder->state; ++} ++ ++GstFlowReturn ++gst_base_video_encoder_end_of_stream (GstBaseVideoEncoder * base_video_encoder, ++ GstBuffer * buffer) ++{ ++ ++ if (base_video_encoder->frames) { ++ GST_WARNING ("EOS with frames left over"); ++ } ++ ++ return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), ++ buffer); ++} ++ ++void ++gst_base_video_encoder_set_latency (GstBaseVideoEncoder * base_video_encoder, ++ GstClockTime min_latency, GstClockTime max_latency) ++{ ++ g_return_if_fail (min_latency >= 0); ++ g_return_if_fail (max_latency >= min_latency); ++ ++ base_video_encoder->min_latency = min_latency; ++ base_video_encoder->max_latency = max_latency; ++} ++ ++void ++gst_base_video_encoder_set_latency_fields (GstBaseVideoEncoder * ++ base_video_encoder, int n_fields) ++{ ++ gint64 latency; ++ ++ latency = gst_util_uint64_scale (n_fields, ++ base_video_encoder->state.fps_d * GST_SECOND, ++ 2 * base_video_encoder->state.fps_n); ++ ++ gst_base_video_encoder_set_latency (base_video_encoder, latency, latency); ++ ++} ++ ++GstVideoFrame * ++gst_base_video_encoder_get_frame (GstBaseVideoEncoder * coder, int frame_number) ++{ ++ GList *g; ++ ++ for (g = coder->frames; g; g = g_list_next (g)) { ++ GstVideoFrame *frame = g->data; ++ ++ if (frame->system_frame_number == frame_number) { ++ return frame; ++ } ++ } ++ ++ return NULL; ++} +diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoencoder.h schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoencoder.h +--- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoencoder.h 1970-01-01 01:00:00.000000000 +0100 ++++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoencoder.h 2009-10-12 12:23:39.000000000 +0200 +@@ -0,0 +1,123 @@ ++/* GStreamer ++ * Copyright (C) 2008 David Schleef ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library 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. ++ */ ++ ++#ifndef _GST_BASE_VIDEO_ENCODER_H_ ++#define _GST_BASE_VIDEO_ENCODER_H_ ++ ++#ifndef GST_USE_UNSTABLE_API ++#warning "GstBaseVideoEncoder is unstable API and may change in future." ++#warning "You can define GST_USE_UNSTABLE_API to avoid this warning." ++#endif ++ ++#include ++#include ++ ++G_BEGIN_DECLS ++ ++#define GST_TYPE_BASE_VIDEO_ENCODER \ ++ (gst_base_video_encoder_get_type()) ++#define GST_BASE_VIDEO_ENCODER(obj) \ ++ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_VIDEO_ENCODER,GstBaseVideoEncoder)) ++#define GST_BASE_VIDEO_ENCODER_CLASS(klass) \ ++ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_VIDEO_ENCODER,GstBaseVideoEncoderClass)) ++#define GST_BASE_VIDEO_ENCODER_GET_CLASS(obj) \ ++ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_VIDEO_ENCODER,GstBaseVideoEncoderClass)) ++#define GST_IS_BASE_VIDEO_ENCODER(obj) \ ++ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_VIDEO_ENCODER)) ++#define GST_IS_BASE_VIDEO_ENCODER_CLASS(obj) \ ++ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_VIDEO_ENCODER)) ++ ++/** ++ * GST_BASE_VIDEO_ENCODER_SINK_NAME: ++ * ++ * The name of the templates for the sink pad. ++ */ ++#define GST_BASE_VIDEO_ENCODER_SINK_NAME "sink" ++/** ++ * GST_BASE_VIDEO_ENCODER_SRC_NAME: ++ * ++ * The name of the templates for the source pad. ++ */ ++#define GST_BASE_VIDEO_ENCODER_SRC_NAME "src" ++ ++ ++typedef struct _GstBaseVideoEncoder GstBaseVideoEncoder; ++typedef struct _GstBaseVideoEncoderClass GstBaseVideoEncoderClass; ++ ++struct _GstBaseVideoEncoder ++{ ++ GstBaseVideoCodec base_video_codec; ++ ++ /*< private >*/ ++ GList *frames; ++ ++ GstVideoState state; ++ ++ gboolean sink_clipping; ++ ++ guint64 presentation_frame_number; ++ guint64 system_frame_number; ++ int distance_from_sync; ++ ++ GstCaps *caps; ++ gboolean set_output_caps; ++ ++ gint64 min_latency; ++ gint64 max_latency; ++}; ++ ++struct _GstBaseVideoEncoderClass ++{ ++ GstBaseVideoCodecClass base_video_codec_class; ++ ++ gboolean (*set_format) (GstBaseVideoEncoder *coder, GstVideoState *state); ++ gboolean (*start) (GstBaseVideoEncoder *coder); ++ gboolean (*stop) (GstBaseVideoEncoder *coder); ++ gboolean (*finish) (GstBaseVideoEncoder *coder, GstVideoFrame *frame); ++ GstFlowReturn (*handle_frame) (GstBaseVideoEncoder *coder, GstVideoFrame *frame); ++ GstFlowReturn (*shape_output) (GstBaseVideoEncoder *coder, GstVideoFrame *frame); ++ GstCaps *(*get_caps) (GstBaseVideoEncoder *coder); ++ ++}; ++ ++GType gst_base_video_encoder_get_type (void); ++ ++int gst_base_video_encoder_get_width (GstBaseVideoEncoder *coder); ++int gst_base_video_encoder_get_height (GstBaseVideoEncoder *coder); ++const GstVideoState *gst_base_video_encoder_get_state (GstBaseVideoEncoder *coder); ++ ++guint64 gst_base_video_encoder_get_timestamp_offset (GstBaseVideoEncoder *coder); ++ ++GstVideoFrame *gst_base_video_encoder_get_frame (GstBaseVideoEncoder *coder, ++ int frame_number); ++GstFlowReturn gst_base_video_encoder_finish_frame (GstBaseVideoEncoder *base_video_encoder, ++ GstVideoFrame *frame); ++GstFlowReturn gst_base_video_encoder_end_of_stream (GstBaseVideoEncoder *base_video_encoder, ++ GstBuffer *buffer); ++ ++void gst_base_video_encoder_set_latency (GstBaseVideoEncoder *base_video_encoder, ++ GstClockTime min_latency, GstClockTime max_latency); ++void gst_base_video_encoder_set_latency_fields (GstBaseVideoEncoder *base_video_encoder, ++ int n_fields); ++ ++ ++G_END_DECLS ++ ++#endif ++ +diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoparse.c schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoparse.c +--- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoparse.c 1970-01-01 01:00:00.000000000 +0100 ++++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoparse.c 2009-10-12 12:23:39.000000000 +0200 +@@ -0,0 +1,871 @@ ++/* Schrodinger ++ * Copyright (C) 2006 David Schleef ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library 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. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include "gstbasevideoparse.h" ++ ++#include ++#include ++ ++GST_DEBUG_CATEGORY_EXTERN (basevideo_debug); ++#define GST_CAT_DEFAULT basevideo_debug ++ ++ ++ ++/* GstBaseVideoParse signals and args */ ++enum ++{ ++ LAST_SIGNAL ++}; ++ ++enum ++{ ++ ARG_0 ++}; ++ ++static void gst_base_video_parse_finalize (GObject * object); ++ ++static const GstQueryType *gst_base_video_parse_get_query_types (GstPad * pad); ++static gboolean gst_base_video_parse_src_query (GstPad * pad, GstQuery * query); ++static gboolean gst_base_video_parse_sink_query (GstPad * pad, ++ GstQuery * query); ++static gboolean gst_base_video_parse_src_event (GstPad * pad, GstEvent * event); ++static gboolean gst_base_video_parse_sink_event (GstPad * pad, ++ GstEvent * event); ++static GstStateChangeReturn gst_base_video_parse_change_state (GstElement * ++ element, GstStateChange transition); ++static GstFlowReturn gst_base_video_parse_push_all (GstBaseVideoParse * ++ base_video_parse, gboolean at_eos); ++static GstFlowReturn gst_base_video_parse_chain (GstPad * pad, GstBuffer * buf); ++static void gst_base_video_parse_free_frame (GstVideoFrame * frame); ++static GstVideoFrame *gst_base_video_parse_new_frame (GstBaseVideoParse * ++ base_video_parse); ++ ++ ++GST_BOILERPLATE (GstBaseVideoParse, gst_base_video_parse, ++ GstBaseVideoCodec, GST_TYPE_BASE_VIDEO_CODEC); ++ ++static void ++gst_base_video_parse_base_init (gpointer g_class) ++{ ++ ++} ++ ++static void ++gst_base_video_parse_class_init (GstBaseVideoParseClass * klass) ++{ ++ GObjectClass *gobject_class; ++ GstElementClass *element_class; ++ ++ gobject_class = G_OBJECT_CLASS (klass); ++ element_class = GST_ELEMENT_CLASS (klass); ++ ++ gobject_class->finalize = gst_base_video_parse_finalize; ++ ++ element_class->change_state = gst_base_video_parse_change_state; ++} ++ ++static void ++gst_base_video_parse_init (GstBaseVideoParse * base_video_parse, ++ GstBaseVideoParseClass * klass) ++{ ++ GstPad *pad; ++ ++ GST_DEBUG ("gst_base_video_parse_init"); ++ ++ pad = GST_BASE_VIDEO_CODEC_SINK_PAD (base_video_parse); ++ ++ gst_pad_set_chain_function (pad, gst_base_video_parse_chain); ++ gst_pad_set_query_function (pad, gst_base_video_parse_sink_query); ++ gst_pad_set_event_function (pad, gst_base_video_parse_sink_event); ++ ++ pad = GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_parse); ++ ++ gst_pad_set_query_type_function (pad, gst_base_video_parse_get_query_types); ++ gst_pad_set_query_function (pad, gst_base_video_parse_src_query); ++ gst_pad_set_event_function (pad, gst_base_video_parse_src_event); ++ ++ base_video_parse->input_adapter = gst_adapter_new (); ++ base_video_parse->output_adapter = gst_adapter_new (); ++ ++ base_video_parse->reorder_depth = 1; ++ ++ base_video_parse->current_frame = ++ gst_base_video_parse_new_frame (base_video_parse); ++} ++ ++static void ++gst_base_video_parse_reset (GstBaseVideoParse * base_video_parse) ++{ ++ GST_DEBUG ("reset"); ++ ++ base_video_parse->discont = TRUE; ++ base_video_parse->have_sync = FALSE; ++ ++ base_video_parse->system_frame_number = 0; ++ base_video_parse->presentation_frame_number = 0; ++ ++ if (base_video_parse->caps) { ++ gst_caps_unref (base_video_parse->caps); ++ base_video_parse->caps = NULL; ++ } ++ ++ gst_segment_init (&base_video_parse->state.segment, GST_FORMAT_TIME); ++ gst_adapter_clear (base_video_parse->input_adapter); ++ gst_adapter_clear (base_video_parse->output_adapter); ++ ++ if (base_video_parse->current_frame) { ++ gst_base_video_parse_free_frame (base_video_parse->current_frame); ++ } ++ base_video_parse->current_frame = ++ gst_base_video_parse_new_frame (base_video_parse); ++ ++} ++ ++static void ++gst_base_video_parse_finalize (GObject * object) ++{ ++ GstBaseVideoParse *base_video_parse; ++ ++ g_return_if_fail (GST_IS_BASE_VIDEO_PARSE (object)); ++ base_video_parse = GST_BASE_VIDEO_PARSE (object); ++ ++ if (base_video_parse->input_adapter) { ++ g_object_unref (base_video_parse->input_adapter); ++ } ++ if (base_video_parse->output_adapter) { ++ g_object_unref (base_video_parse->output_adapter); ++ } ++ ++ G_OBJECT_CLASS (parent_class)->finalize (object); ++} ++ ++static const GstQueryType * ++gst_base_video_parse_get_query_types (GstPad * pad) ++{ ++ static const GstQueryType query_types[] = { ++ GST_QUERY_POSITION, ++ GST_QUERY_DURATION, ++ GST_QUERY_CONVERT, ++ 0 ++ }; ++ ++ return query_types; ++} ++ ++#if 0 ++static gboolean ++gst_base_video_parse_src_convert (GstPad * pad, ++ GstFormat src_format, gint64 src_value, ++ GstFormat * dest_format, gint64 * dest_value) ++{ ++ gboolean res; ++ GstBaseVideoParse *dec; ++ ++ if (src_format == *dest_format) { ++ *dest_value = src_value; ++ return TRUE; ++ } ++ ++ dec = GST_BASE_VIDEO_PARSE (gst_pad_get_parent (pad)); ++ ++ if (src_format == GST_FORMAT_DEFAULT && *dest_format == GST_FORMAT_TIME) { ++ if (dec->fps_d != 0) { ++ *dest_value = gst_util_uint64_scale (granulepos_to_frame (src_value), ++ dec->fps_d * GST_SECOND, dec->fps_n); ++ res = TRUE; ++ } else { ++ res = FALSE; ++ } ++ } else { ++ GST_WARNING ("unhandled conversion from %d to %d", src_format, ++ *dest_format); ++ res = FALSE; ++ } ++ ++ gst_object_unref (dec); ++ ++ return res; ++} ++ ++static gboolean ++gst_base_video_parse_sink_convert (GstPad * pad, ++ GstFormat src_format, gint64 src_value, ++ GstFormat * dest_format, gint64 * dest_value) ++{ ++ gboolean res = TRUE; ++ GstBaseVideoParse *dec; ++ ++ if (src_format == *dest_format) { ++ *dest_value = src_value; ++ return TRUE; ++ } ++ ++ dec = GST_BASE_VIDEO_PARSE (gst_pad_get_parent (pad)); ++ ++ /* FIXME: check if we are in a decoding state */ ++ ++ switch (src_format) { ++ case GST_FORMAT_DEFAULT: ++ switch (*dest_format) { ++ case GST_FORMAT_TIME: ++ *dest_value = gst_util_uint64_scale (src_value, ++ dec->fps_d * GST_SECOND, dec->fps_n); ++ break; ++ default: ++ res = FALSE; ++ } ++ break; ++ case GST_FORMAT_TIME: ++ switch (*dest_format) { ++ case GST_FORMAT_DEFAULT: ++ { ++ *dest_value = gst_util_uint64_scale (src_value, ++ dec->fps_n, dec->fps_d * GST_SECOND); ++ break; ++ } ++ default: ++ res = FALSE; ++ break; ++ } ++ break; ++ default: ++ res = FALSE; ++ break; ++ } ++ ++ gst_object_unref (dec); ++ ++ return res; ++} ++#endif ++ ++static gboolean ++gst_base_video_parse_src_query (GstPad * pad, GstQuery * query) ++{ ++ GstBaseVideoParse *base_parse; ++ gboolean res = FALSE; ++ ++ base_parse = GST_BASE_VIDEO_PARSE (gst_pad_get_parent (pad)); ++ ++ switch (GST_QUERY_TYPE (query)) { ++ case GST_QUERY_POSITION: ++ { ++ GstFormat format; ++ gint64 time; ++ gint64 value; ++ ++ gst_query_parse_position (query, &format, NULL); ++ ++ time = gst_util_uint64_scale (base_parse->presentation_frame_number, ++ base_parse->state.fps_n, base_parse->state.fps_d); ++ time += base_parse->state.segment.time; ++ GST_DEBUG ("query position %" G_GINT64_FORMAT, time); ++ res = gst_base_video_encoded_video_convert (&base_parse->state, ++ GST_FORMAT_TIME, time, &format, &value); ++ if (!res) ++ goto error; ++ ++ gst_query_set_position (query, format, value); ++ break; ++ } ++ case GST_QUERY_DURATION: ++ res = ++ gst_pad_query (GST_PAD_PEER (GST_BASE_VIDEO_CODEC_SINK_PAD ++ (base_parse)), query); ++ if (!res) ++ goto error; ++ break; ++ case GST_QUERY_CONVERT: ++ { ++ GstFormat src_fmt, dest_fmt; ++ gint64 src_val, dest_val; ++ ++ GST_WARNING ("query convert"); ++ ++ gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); ++ res = gst_base_video_encoded_video_convert (&base_parse->state, ++ src_fmt, src_val, &dest_fmt, &dest_val); ++ if (!res) ++ goto error; ++ gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); ++ break; ++ } ++ default: ++ res = gst_pad_query_default (pad, query); ++ break; ++ } ++done: ++ gst_object_unref (base_parse); ++ ++ return res; ++error: ++ GST_DEBUG_OBJECT (base_parse, "query failed"); ++ goto done; ++} ++ ++static gboolean ++gst_base_video_parse_sink_query (GstPad * pad, GstQuery * query) ++{ ++ GstBaseVideoParse *base_video_parse; ++ gboolean res = FALSE; ++ ++ base_video_parse = GST_BASE_VIDEO_PARSE (gst_pad_get_parent (pad)); ++ ++ switch (GST_QUERY_TYPE (query)) { ++ case GST_QUERY_CONVERT: ++ { ++ GstFormat src_fmt, dest_fmt; ++ gint64 src_val, dest_val; ++ ++ gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); ++ res = gst_base_video_encoded_video_convert (&base_video_parse->state, ++ src_fmt, src_val, &dest_fmt, &dest_val); ++ if (!res) ++ goto error; ++ gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); ++ break; ++ } ++ default: ++ res = gst_pad_query_default (pad, query); ++ break; ++ } ++done: ++ gst_object_unref (base_video_parse); ++ ++ return res; ++error: ++ GST_DEBUG_OBJECT (base_video_parse, "query failed"); ++ goto done; ++} ++ ++static gboolean ++gst_base_video_parse_src_event (GstPad * pad, GstEvent * event) ++{ ++ GstBaseVideoParse *base_video_parse; ++ gboolean res = FALSE; ++ ++ base_video_parse = GST_BASE_VIDEO_PARSE (gst_pad_get_parent (pad)); ++ ++ switch (GST_EVENT_TYPE (event)) { ++ case GST_EVENT_SEEK: ++ { ++ GstFormat format, tformat; ++ gdouble rate; ++ GstEvent *real_seek; ++ GstSeekFlags flags; ++ GstSeekType cur_type, stop_type; ++ gint64 cur, stop; ++ gint64 tcur, tstop; ++ ++ gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, ++ &cur, &stop_type, &stop); ++ gst_event_unref (event); ++ ++ tformat = GST_FORMAT_TIME; ++ res = gst_base_video_encoded_video_convert (&base_video_parse->state, ++ format, cur, &tformat, &tcur); ++ if (!res) ++ goto convert_error; ++ res = gst_base_video_encoded_video_convert (&base_video_parse->state, ++ format, stop, &tformat, &tstop); ++ if (!res) ++ goto convert_error; ++ ++ real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME, ++ flags, cur_type, tcur, stop_type, tstop); ++ ++ res = ++ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SINK_PAD (base_video_parse), ++ real_seek); ++ ++ break; ++ } ++#if 0 ++ case GST_EVENT_QOS: ++ { ++ gdouble proportion; ++ GstClockTimeDiff diff; ++ GstClockTime timestamp; ++ ++ gst_event_parse_qos (event, &proportion, &diff, ×tamp); ++ ++ GST_OBJECT_LOCK (base_video_parse); ++ base_video_parse->proportion = proportion; ++ base_video_parse->earliest_time = timestamp + diff; ++ GST_OBJECT_UNLOCK (base_video_parse); ++ ++ GST_DEBUG_OBJECT (base_video_parse, ++ "got QoS %" GST_TIME_FORMAT ", %" G_GINT64_FORMAT, ++ GST_TIME_ARGS (timestamp), diff); ++ ++ res = gst_pad_push_event (base_video_parse->sinkpad, event); ++ break; ++ } ++#endif ++ default: ++ res = ++ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SINK_PAD (base_video_parse), ++ event); ++ break; ++ } ++done: ++ gst_object_unref (base_video_parse); ++ return res; ++ ++convert_error: ++ GST_DEBUG_OBJECT (base_video_parse, "could not convert format"); ++ goto done; ++} ++ ++static gboolean ++gst_base_video_parse_sink_event (GstPad * pad, GstEvent * event) ++{ ++ GstBaseVideoParse *base_video_parse; ++ gboolean ret = FALSE; ++ ++ base_video_parse = GST_BASE_VIDEO_PARSE (gst_pad_get_parent (pad)); ++ ++ switch (GST_EVENT_TYPE (event)) { ++ case GST_EVENT_FLUSH_START: ++ ret = ++ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_parse), ++ event); ++ break; ++ case GST_EVENT_FLUSH_STOP: ++ gst_base_video_parse_reset (base_video_parse); ++ ret = ++ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_parse), ++ event); ++ break; ++ case GST_EVENT_EOS: ++ if (gst_base_video_parse_push_all (base_video_parse, ++ FALSE) == GST_FLOW_ERROR) { ++ gst_event_unref (event); ++ return FALSE; ++ } ++ ++ ret = ++ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_parse), ++ event); ++ break; ++ case GST_EVENT_NEWSEGMENT: ++ { ++ gboolean update; ++ GstFormat format; ++ gdouble rate; ++ gint64 start, stop, time; ++ ++ gst_event_parse_new_segment (event, &update, &rate, &format, &start, ++ &stop, &time); ++ ++ if (format != GST_FORMAT_TIME) ++ goto newseg_wrong_format; ++ ++ if (rate <= 0.0) ++ goto newseg_wrong_rate; ++ ++ GST_DEBUG ("newsegment %" G_GINT64_FORMAT " %" G_GINT64_FORMAT, start, ++ time); ++ gst_segment_set_newsegment (&base_video_parse->state.segment, update, ++ rate, format, start, stop, time); ++ ++ ret = ++ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_parse), ++ event); ++ break; ++ } ++ default: ++ ret = ++ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_parse), ++ event); ++ break; ++ } ++done: ++ gst_object_unref (base_video_parse); ++ return ret; ++ ++newseg_wrong_format: ++ GST_DEBUG_OBJECT (base_video_parse, "received non TIME newsegment"); ++ gst_event_unref (event); ++ goto done; ++ ++newseg_wrong_rate: ++ GST_DEBUG_OBJECT (base_video_parse, "negative rates not supported"); ++ gst_event_unref (event); ++ goto done; ++} ++ ++ ++static GstStateChangeReturn ++gst_base_video_parse_change_state (GstElement * element, ++ GstStateChange transition) ++{ ++ GstBaseVideoParse *base_parse = GST_BASE_VIDEO_PARSE (element); ++ GstStateChangeReturn ret; ++ ++ switch (transition) { ++ case GST_STATE_CHANGE_NULL_TO_READY: ++ break; ++ case GST_STATE_CHANGE_READY_TO_PAUSED: ++ gst_base_video_parse_reset (base_parse); ++ break; ++ case GST_STATE_CHANGE_PAUSED_TO_PLAYING: ++ break; ++ default: ++ break; ++ } ++ ++ ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); ++ ++ switch (transition) { ++ case GST_STATE_CHANGE_PLAYING_TO_PAUSED: ++ break; ++ case GST_STATE_CHANGE_PAUSED_TO_READY: ++ gst_base_video_parse_reset (base_parse); ++ break; ++ case GST_STATE_CHANGE_READY_TO_NULL: ++ break; ++ default: ++ break; ++ } ++ ++ return ret; ++} ++ ++static guint64 ++gst_base_video_parse_get_timestamp (GstBaseVideoParse * base_video_parse, ++ int picture_number) ++{ ++ if (picture_number < 0) { ++ return base_video_parse->timestamp_offset - ++ (gint64) gst_util_uint64_scale (-picture_number, ++ base_video_parse->state.fps_d * GST_SECOND, ++ base_video_parse->state.fps_n); ++ } else { ++ return base_video_parse->timestamp_offset + ++ gst_util_uint64_scale (picture_number, ++ base_video_parse->state.fps_d * GST_SECOND, ++ base_video_parse->state.fps_n); ++ } ++} ++ ++static GstFlowReturn ++gst_base_video_parse_push_all (GstBaseVideoParse * base_video_parse, ++ gboolean at_eos) ++{ ++ GstFlowReturn ret = GST_FLOW_OK; ++ ++ /* FIXME do stuff */ ++ ++ return ret; ++} ++ ++static GstBuffer * ++gst_adapter_get_buffer (GstAdapter * adapter) ++{ ++ return gst_buffer_ref (GST_BUFFER (adapter->buflist->data)); ++ ++} ++ ++static GstFlowReturn ++gst_base_video_parse_chain (GstPad * pad, GstBuffer * buf) ++{ ++ GstBaseVideoParse *base_video_parse; ++ GstBaseVideoParseClass *klass; ++ GstBuffer *buffer; ++ GstFlowReturn ret; ++ ++ GST_DEBUG ("chain with %d bytes", GST_BUFFER_SIZE (buf)); ++ ++ base_video_parse = GST_BASE_VIDEO_PARSE (GST_PAD_PARENT (pad)); ++ klass = GST_BASE_VIDEO_PARSE_GET_CLASS (base_video_parse); ++ ++ if (!base_video_parse->started) { ++ klass->start (base_video_parse); ++ base_video_parse->started = TRUE; ++ } ++ ++ if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DISCONT))) { ++ GST_DEBUG_OBJECT (base_video_parse, "received DISCONT buffer"); ++ gst_base_video_parse_reset (base_video_parse); ++ base_video_parse->discont = TRUE; ++ base_video_parse->have_sync = FALSE; ++ } ++ ++ if (GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) { ++ base_video_parse->last_timestamp = GST_BUFFER_TIMESTAMP (buf); ++ } ++ gst_adapter_push (base_video_parse->input_adapter, buf); ++ ++ if (!base_video_parse->have_sync) { ++ int n, m; ++ ++ GST_DEBUG ("no sync, scanning"); ++ ++ n = gst_adapter_available (base_video_parse->input_adapter); ++ m = klass->scan_for_sync (base_video_parse->input_adapter, FALSE, 0, n); ++ ++ gst_adapter_flush (base_video_parse->input_adapter, m); ++ ++ if (m < n) { ++ GST_DEBUG ("found possible sync after %d bytes (of %d)", m, n); ++ ++ /* this is only "maybe" sync */ ++ base_video_parse->have_sync = TRUE; ++ } ++ ++ if (!base_video_parse->have_sync) { ++ return GST_FLOW_OK; ++ } ++ } ++ ++ /* FIXME: use gst_adapter_prev_timestamp() here instead? */ ++ buffer = gst_adapter_get_buffer (base_video_parse->input_adapter); ++ ++ gst_buffer_unref (buffer); ++ ++ /* FIXME check klass->parse_data */ ++ ++ do { ++ ret = klass->parse_data (base_video_parse, FALSE); ++ } while (ret == GST_FLOW_OK); ++ ++ if (ret == GST_BASE_VIDEO_PARSE_FLOW_NEED_DATA) { ++ return GST_FLOW_OK; ++ } ++ return ret; ++} ++ ++GstVideoState * ++gst_base_video_parse_get_state (GstBaseVideoParse * base_video_parse) ++{ ++ return &base_video_parse->state; ++} ++ ++void ++gst_base_video_parse_set_state (GstBaseVideoParse * base_video_parse, ++ GstVideoState * state) ++{ ++ GST_DEBUG ("set_state"); ++ ++ memcpy (&base_video_parse->state, state, sizeof (GstVideoState)); ++ ++ /* FIXME set caps */ ++ ++} ++ ++ ++gboolean ++gst_base_video_parse_set_src_caps (GstBaseVideoParse * base_video_parse, ++ GstCaps * caps) ++{ ++ g_return_val_if_fail (GST_IS_BASE_VIDEO_PARSE (base_video_parse), FALSE); ++ ++ GST_DEBUG ("set_src_caps"); ++ ++ return gst_pad_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_parse), ++ caps); ++} ++ ++void ++gst_base_video_parse_lost_sync (GstBaseVideoParse * base_video_parse) ++{ ++ g_return_if_fail (GST_IS_BASE_VIDEO_PARSE (base_video_parse)); ++ ++ GST_DEBUG ("lost_sync"); ++ ++ if (gst_adapter_available (base_video_parse->input_adapter) >= 1) { ++ gst_adapter_flush (base_video_parse->input_adapter, 1); ++ } ++ ++ base_video_parse->have_sync = FALSE; ++} ++ ++GstVideoFrame * ++gst_base_video_parse_get_frame (GstBaseVideoParse * base_video_parse) ++{ ++ g_return_val_if_fail (GST_IS_BASE_VIDEO_PARSE (base_video_parse), NULL); ++ ++ return base_video_parse->current_frame; ++} ++ ++void ++gst_base_video_parse_add_to_frame (GstBaseVideoParse * base_video_parse, ++ int n_bytes) ++{ ++ GstBuffer *buf; ++ ++ GST_DEBUG ("add_to_frame"); ++ ++ buf = gst_adapter_take_buffer (base_video_parse->input_adapter, n_bytes); ++ ++ gst_adapter_push (base_video_parse->output_adapter, buf); ++} ++ ++GstFlowReturn ++gst_base_video_parse_finish_frame (GstBaseVideoParse * base_video_parse) ++{ ++ GstVideoFrame *frame = base_video_parse->current_frame; ++ GstBuffer *buffer; ++ GstBaseVideoParseClass *base_video_parse_class; ++ GstFlowReturn ret; ++ ++ GST_DEBUG ("finish_frame"); ++ ++ base_video_parse_class = GST_BASE_VIDEO_PARSE_GET_CLASS (base_video_parse); ++ ++ buffer = gst_adapter_take_buffer (base_video_parse->output_adapter, ++ gst_adapter_available (base_video_parse->output_adapter)); ++ ++ if (frame->is_sync_point) { ++ base_video_parse->timestamp_offset = base_video_parse->last_timestamp - ++ gst_util_uint64_scale (frame->presentation_frame_number, ++ base_video_parse->state.fps_d * GST_SECOND, ++ base_video_parse->state.fps_n); ++ base_video_parse->distance_from_sync = 0; ++ } ++ ++ frame->distance_from_sync = base_video_parse->distance_from_sync; ++ base_video_parse->distance_from_sync++; ++ ++ frame->presentation_timestamp = ++ gst_base_video_parse_get_timestamp (base_video_parse, ++ frame->presentation_frame_number); ++ frame->presentation_duration = ++ gst_base_video_parse_get_timestamp (base_video_parse, ++ frame->presentation_frame_number + 1) - frame->presentation_timestamp; ++ frame->decode_timestamp = ++ gst_base_video_parse_get_timestamp (base_video_parse, ++ frame->decode_frame_number); ++ ++ GST_BUFFER_TIMESTAMP (buffer) = frame->presentation_timestamp; ++ GST_BUFFER_DURATION (buffer) = frame->presentation_duration; ++ if (frame->decode_frame_number < 0) { ++ GST_BUFFER_OFFSET (buffer) = 0; ++ } else { ++ GST_BUFFER_OFFSET (buffer) = frame->decode_timestamp; ++ } ++ GST_BUFFER_OFFSET_END (buffer) = GST_CLOCK_TIME_NONE; ++ ++ GST_DEBUG ("pts %" GST_TIME_FORMAT, ++ GST_TIME_ARGS (frame->presentation_timestamp)); ++ GST_DEBUG ("dts %" GST_TIME_FORMAT, GST_TIME_ARGS (frame->decode_timestamp)); ++ GST_DEBUG ("dist %d", frame->distance_from_sync); ++ ++ if (frame->is_sync_point) { ++ GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DELTA_UNIT); ++ } else { ++ GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT); ++ } ++ ++ frame->src_buffer = buffer; ++ ret = base_video_parse_class->shape_output (base_video_parse, frame); ++ ++ gst_base_video_parse_free_frame (base_video_parse->current_frame); ++ ++ /* create new frame */ ++ base_video_parse->current_frame = ++ gst_base_video_parse_new_frame (base_video_parse); ++ ++ return ret; ++} ++ ++static void ++gst_base_video_parse_free_frame (GstVideoFrame * frame) ++{ ++ if (frame->sink_buffer) { ++ gst_buffer_unref (frame->sink_buffer); ++ } ++#if 0 ++ if (frame->src_buffer) { ++ gst_buffer_unref (frame->src_buffer); ++ } ++#endif ++ ++ g_free (frame); ++} ++ ++static GstVideoFrame * ++gst_base_video_parse_new_frame (GstBaseVideoParse * base_video_parse) ++{ ++ GstVideoFrame *frame; ++ ++ frame = g_malloc0 (sizeof (GstVideoFrame)); ++ ++ frame->system_frame_number = base_video_parse->system_frame_number; ++ base_video_parse->system_frame_number++; ++ ++ frame->decode_frame_number = frame->system_frame_number - ++ base_video_parse->reorder_depth; ++ ++ return frame; ++} ++ ++void ++gst_base_video_parse_set_sync_point (GstBaseVideoParse * base_video_parse) ++{ ++ GST_DEBUG ("set_sync_point"); ++ ++ base_video_parse->current_frame->is_sync_point = TRUE; ++ ++ base_video_parse->distance_from_sync = 0; ++} ++ ++GstFlowReturn ++gst_base_video_parse_push (GstBaseVideoParse * base_video_parse, ++ GstBuffer * buffer) ++{ ++ GstBaseVideoParseClass *base_video_parse_class; ++ ++ base_video_parse_class = GST_BASE_VIDEO_PARSE_GET_CLASS (base_video_parse); ++ ++ if (base_video_parse->caps == NULL) { ++ gboolean ret; ++ ++ base_video_parse->caps = ++ base_video_parse_class->get_caps (base_video_parse); ++ ++ ret = gst_pad_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_parse), ++ base_video_parse->caps); ++ ++ if (!ret) { ++ GST_WARNING ("pad didn't accept caps"); ++ return GST_FLOW_ERROR; ++ } ++ } ++ gst_buffer_set_caps (buffer, base_video_parse->caps); ++ ++ GST_DEBUG ("pushing ts=%" G_GINT64_FORMAT " dur=%" G_GINT64_FORMAT " off=%" ++ G_GINT64_FORMAT " off_end=%" G_GINT64_FORMAT, ++ GST_BUFFER_TIMESTAMP (buffer), GST_BUFFER_DURATION (buffer), ++ GST_BUFFER_OFFSET (buffer), GST_BUFFER_OFFSET_END (buffer)); ++ ++ if (base_video_parse->discont) { ++ GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT); ++ base_video_parse->discont = FALSE; ++ } else { ++ GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DISCONT); ++ } ++ ++ return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_parse), buffer); ++} +diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoparse.h schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoparse.h +--- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoparse.h 1970-01-01 01:00:00.000000000 +0100 ++++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoparse.h 2009-09-11 17:35:39.000000000 +0200 +@@ -0,0 +1,141 @@ ++/* GStreamer ++ * Copyright (C) 2008 David Schleef ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library 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. ++ */ ++ ++#ifndef _GST_BASE_VIDEO_PARSE_H_ ++#define _GST_BASE_VIDEO_PARSE_H_ ++ ++#ifndef GST_USE_UNSTABLE_API ++#warning "GstBaseVideoParse is unstable API and may change in future." ++#warning "You can define GST_USE_UNSTABLE_API to avoid this warning." ++#endif ++ ++#include ++#include ++ ++G_BEGIN_DECLS ++ ++#define GST_TYPE_BASE_VIDEO_PARSE \ ++ (gst_base_video_parse_get_type()) ++#define GST_BASE_VIDEO_PARSE(obj) \ ++ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_VIDEO_PARSE,GstBaseVideoParse)) ++#define GST_BASE_VIDEO_PARSE_CLASS(klass) \ ++ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_VIDEO_PARSE,GstBaseVideoParseClass)) ++#define GST_BASE_VIDEO_PARSE_GET_CLASS(obj) \ ++ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_VIDEO_PARSE,GstBaseVideoParseClass)) ++#define GST_IS_BASE_VIDEO_PARSE(obj) \ ++ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_VIDEO_PARSE)) ++#define GST_IS_BASE_VIDEO_PARSE_CLASS(obj) \ ++ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_VIDEO_PARSE)) ++ ++/** ++ * GST_BASE_VIDEO_PARSE_SINK_NAME: ++ * ++ * The name of the templates for the sink pad. ++ */ ++#define GST_BASE_VIDEO_PARSE_SINK_NAME "sink" ++/** ++ * GST_BASE_VIDEO_PARSE_SRC_NAME: ++ * ++ * The name of the templates for the source pad. ++ */ ++#define GST_BASE_VIDEO_PARSE_SRC_NAME "src" ++ ++/** ++ * GST_BASE_VIDEO_PARSE_FLOW_NEED_DATA: ++ * ++ */ ++#define GST_BASE_VIDEO_PARSE_FLOW_NEED_DATA GST_FLOW_CUSTOM_SUCCESS ++ ++typedef struct _GstBaseVideoParse GstBaseVideoParse; ++typedef struct _GstBaseVideoParseClass GstBaseVideoParseClass; ++ ++struct _GstBaseVideoParse ++{ ++ GstBaseVideoCodec base_video_codec; ++ ++ /*< private >*/ ++ GstAdapter *input_adapter; ++ GstAdapter *output_adapter; ++ ++ int reorder_depth; ++ ++ gboolean have_sync; ++ gboolean discont; ++ gboolean started; ++ ++ GstVideoFrame *current_frame; ++ GstVideoState state; ++ int distance_from_sync; ++ ++ gboolean sink_clipping; ++ ++ guint64 presentation_frame_number; ++ guint64 system_frame_number; ++ ++ GstCaps *caps; ++ gboolean set_output_caps; ++ ++ GstClockTime last_timestamp; ++ ++ gint64 timestamp_offset; ++}; ++ ++struct _GstBaseVideoParseClass ++{ ++ GstBaseVideoCodecClass base_video_codec_class; ++ ++ gboolean (*start) (GstBaseVideoParse *parse); ++ gboolean (*stop) (GstBaseVideoParse *parse); ++ gboolean (*reset) (GstBaseVideoParse *parse); ++ GstFlowReturn (*parse_data) (GstBaseVideoParse *parse, gboolean at_eos); ++ int (*scan_for_sync) (GstAdapter *adapter, gboolean at_eos, ++ int offset, int n); ++ GstFlowReturn (*shape_output) (GstBaseVideoParse *parse, GstVideoFrame *frame); ++ GstCaps *(*get_caps) (GstBaseVideoParse *parse); ++ ++}; ++ ++GType gst_base_video_parse_get_type (void); ++ ++int gst_base_video_parse_get_width (GstBaseVideoParse *parse); ++int gst_base_video_parse_get_height (GstBaseVideoParse *parse); ++GstVideoState *gst_base_video_parse_get_state (GstBaseVideoParse *parse); ++void gst_base_video_parse_set_state (GstBaseVideoParse *parse, ++ GstVideoState *state); ++ ++guint64 gst_base_video_parse_get_timestamp_offset (GstBaseVideoParse *parse); ++ ++gboolean gst_base_video_parse_set_src_caps (GstBaseVideoParse *base_video_parse, GstCaps *caps); ++ ++GstFlowReturn gst_base_video_parse_end_of_stream (GstBaseVideoParse *base_video_parse, ++ GstBuffer *buffer); ++ ++void gst_base_video_parse_lost_sync (GstBaseVideoParse *base_video_parse); ++ ++GstVideoFrame * gst_base_video_parse_get_frame (GstBaseVideoParse *base_video_parse); ++void gst_base_video_parse_add_to_frame (GstBaseVideoParse *base_video_parse, int n_bytes); ++GstFlowReturn gst_base_video_parse_finish_frame (GstBaseVideoParse *base_video_parse); ++void gst_base_video_parse_set_sync_point (GstBaseVideoParse *base_video_parse); ++GstFlowReturn gst_base_video_parse_push (GstBaseVideoParse *base_video_parse, ++ GstBuffer *buffer); ++ ++G_END_DECLS ++ ++#endif ++ +diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoutils.c schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoutils.c +--- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoutils.c 1970-01-01 01:00:00.000000000 +0100 ++++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoutils.c 2009-10-12 12:23:39.000000000 +0200 +@@ -0,0 +1,163 @@ ++/* GStreamer ++ * Copyright (C) 2008 David Schleef ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library 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. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include "gstbasevideoutils.h" ++ ++#include ++ ++GST_DEBUG_CATEGORY_EXTERN (basevideo_debug); ++#define GST_CAT_DEFAULT basevideo_debug ++ ++ ++guint64 ++gst_base_video_convert_bytes_to_frames (GstVideoState * state, guint64 bytes) ++{ ++ return gst_util_uint64_scale_int (bytes, 1, state->bytes_per_picture); ++} ++ ++guint64 ++gst_base_video_convert_frames_to_bytes (GstVideoState * state, guint64 frames) ++{ ++ return frames * state->bytes_per_picture; ++} ++ ++ ++gboolean ++gst_base_video_rawvideo_convert (GstVideoState * state, ++ GstFormat src_format, gint64 src_value, ++ GstFormat * dest_format, gint64 * dest_value) ++{ ++ gboolean res = FALSE; ++ ++ if (src_format == *dest_format) { ++ *dest_value = src_value; ++ return TRUE; ++ } ++ ++ if (src_format == GST_FORMAT_BYTES && ++ *dest_format == GST_FORMAT_DEFAULT && state->bytes_per_picture != 0) { ++ /* convert bytes to frames */ ++ *dest_value = gst_util_uint64_scale_int (src_value, 1, ++ state->bytes_per_picture); ++ res = TRUE; ++ } else if (src_format == GST_FORMAT_DEFAULT && ++ *dest_format == GST_FORMAT_BYTES && state->bytes_per_picture != 0) { ++ /* convert bytes to frames */ ++ *dest_value = src_value * state->bytes_per_picture; ++ res = TRUE; ++ } else if (src_format == GST_FORMAT_DEFAULT && ++ *dest_format == GST_FORMAT_TIME && state->fps_n != 0) { ++ /* convert frames to time */ ++ /* FIXME add segment time? */ ++ *dest_value = gst_util_uint64_scale (src_value, ++ GST_SECOND * state->fps_d, state->fps_n); ++ res = TRUE; ++ } else if (src_format == GST_FORMAT_TIME && ++ *dest_format == GST_FORMAT_DEFAULT && state->fps_d != 0) { ++ /* convert time to frames */ ++ /* FIXME subtract segment time? */ ++ *dest_value = gst_util_uint64_scale (src_value, state->fps_n, ++ GST_SECOND * state->fps_d); ++ res = TRUE; ++ } ++ ++ /* FIXME add bytes <--> time */ ++ ++ return res; ++} ++ ++gboolean ++gst_base_video_encoded_video_convert (GstVideoState * state, ++ GstFormat src_format, gint64 src_value, ++ GstFormat * dest_format, gint64 * dest_value) ++{ ++ gboolean res = FALSE; ++ ++ if (src_format == *dest_format) { ++ *dest_value = src_value; ++ return TRUE; ++ } ++ ++ GST_DEBUG ("src convert"); ++ ++#if 0 ++ if (src_format == GST_FORMAT_DEFAULT && *dest_format == GST_FORMAT_TIME) { ++ if (dec->fps_d != 0) { ++ *dest_value = gst_util_uint64_scale (granulepos_to_frame (src_value), ++ dec->fps_d * GST_SECOND, dec->fps_n); ++ res = TRUE; ++ } else { ++ res = FALSE; ++ } ++ } else { ++ GST_WARNING ("unhandled conversion from %d to %d", src_format, ++ *dest_format); ++ res = FALSE; ++ } ++#endif ++ ++ return res; ++} ++ ++gboolean ++gst_base_video_state_from_caps (GstVideoState * state, GstCaps * caps) ++{ ++ ++ gst_video_format_parse_caps (caps, &state->format, ++ &state->width, &state->height); ++ ++ if (!gst_video_parse_caps_framerate (caps, &state->fps_n, &state->fps_d)) ++ return FALSE; ++ ++ state->par_n = 1; ++ state->par_d = 1; ++ gst_video_parse_caps_pixel_aspect_ratio (caps, &state->par_n, &state->par_d); ++ ++ { ++ GstStructure *structure = gst_caps_get_structure (caps, 0); ++ state->interlaced = FALSE; ++ gst_structure_get_boolean (structure, "interlaced", &state->interlaced); ++ } ++ ++ state->clean_width = state->width; ++ state->clean_height = state->height; ++ state->clean_offset_left = 0; ++ state->clean_offset_top = 0; ++ ++ /* FIXME need better error handling */ ++ return TRUE; ++} ++ ++GstClockTime ++gst_video_state_get_timestamp (const GstVideoState * state, int frame_number) ++{ ++ if (frame_number < 0) { ++ return state->segment.start - ++ (gint64) gst_util_uint64_scale (-frame_number, ++ state->fps_d * GST_SECOND, state->fps_n); ++ } else { ++ return state->segment.start + ++ gst_util_uint64_scale (frame_number, ++ state->fps_d * GST_SECOND, state->fps_n); ++ } ++} +diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoutils.h schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoutils.h +--- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoutils.h 1970-01-01 01:00:00.000000000 +0100 ++++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoutils.h 2009-09-11 17:35:39.000000000 +0200 +@@ -0,0 +1,95 @@ ++/* GStreamer ++ * Copyright (C) 2008 David Schleef ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library 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. ++ */ ++ ++#ifndef _GST_BASE_VIDEO_UTILS_H_ ++#define _GST_BASE_VIDEO_UTILS_H_ ++ ++#ifndef GST_USE_UNSTABLE_API ++#warning "The base video utils API is unstable and may change in future." ++#warning "You can define GST_USE_UNSTABLE_API to avoid this warning." ++#endif ++ ++#include ++#include ++#include ++ ++G_BEGIN_DECLS ++ ++typedef struct _GstVideoState GstVideoState; ++typedef struct _GstVideoFrame GstVideoFrame; ++ ++struct _GstVideoState ++{ ++ GstVideoFormat format; ++ int width, height; ++ int fps_n, fps_d; ++ int par_n, par_d; ++ gboolean interlaced; ++ gboolean top_field_first; ++ ++ int clean_width, clean_height; ++ int clean_offset_left, clean_offset_top; ++ ++ int bytes_per_picture; ++ ++ GstSegment segment; ++ ++ int picture_number; ++}; ++ ++struct _GstVideoFrame ++{ ++ guint64 decode_timestamp; ++ guint64 presentation_timestamp; ++ guint64 presentation_duration; ++ ++ gint system_frame_number; ++ gint decode_frame_number; ++ gint presentation_frame_number; ++ ++ int distance_from_sync; ++ gboolean is_sync_point; ++ gboolean is_eos; ++ ++ GstBuffer *sink_buffer; ++ GstBuffer *src_buffer; ++ ++ int field_index; ++ int n_fields; ++ ++ void *coder_hook; ++}; ++ ++gboolean gst_base_video_rawvideo_convert (GstVideoState *state, ++ GstFormat src_format, gint64 src_value, ++ GstFormat * dest_format, gint64 *dest_value); ++gboolean gst_base_video_encoded_video_convert (GstVideoState *state, ++ GstFormat src_format, gint64 src_value, ++ GstFormat * dest_format, gint64 *dest_value); ++ ++gboolean gst_base_video_state_from_caps (GstVideoState *state, ++ GstCaps *caps); ++ ++GstClockTime gst_video_state_get_timestamp (const GstVideoState *state, ++ int frame_number); ++ ++G_END_DECLS ++ ++#endif ++ +diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/Makefile.am schroedinger-1.0.8/gst-libs/gst/video/Makefile.am +--- schroedinger-1.0.8.orig/gst-libs/gst/video/Makefile.am 1970-01-01 01:00:00.000000000 +0100 ++++ schroedinger-1.0.8/gst-libs/gst/video/Makefile.am 2009-09-11 17:35:39.000000000 +0200 +@@ -0,0 +1,24 @@ ++ ++lib_LTLIBRARIES = libgstbasevideo-@GST_MAJORMINOR@.la ++ ++CLEANFILES = $(BUILT_SOURCES) ++ ++libgstbasevideo_@GST_MAJORMINOR@_la_SOURCES = \ ++ gstbasevideoutils.c \ ++ gstbasevideocodec.c \ ++ gstbasevideodecoder.c \ ++ gstbasevideoencoder.c \ ++ gstbasevideoparse.c ++ ++libgstbasevideo_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/video ++libgstbasevideo_@GST_MAJORMINOR@include_HEADERS = \ ++ gstbasevideoutils.h \ ++ gstbasevideocodec.h \ ++ gstbasevideodecoder.h \ ++ gstbasevideoencoder.h \ ++ gstbasevideoparse.h ++ ++libgstbasevideo_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) -DGST_USE_UNSTABLE_API -I$(top_srcdir)/gst-libs ++libgstbasevideo_@GST_MAJORMINOR@_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) -lgstvideo-@GST_MAJORMINOR@ ++libgstbasevideo_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) -static ++ diff --git a/gst-plugins-schroedinger-plug.patch b/gst-plugins-schroedinger-plug.patch new file mode 100644 index 0000000..12370dd --- /dev/null +++ b/gst-plugins-schroedinger-plug.patch @@ -0,0 +1,74 @@ +--- schroedinger-1.0.8.orig/configure.ac 2009-09-29 07:23:37.000000000 +0200 ++++ schroedinger-1.0.8/configure.ac 2009-04-23 05:20:57.000000000 +0200 +@@ -150,6 +150,47 @@ + SCHRO_CFLAGS="$SCHRO_CFLAGS -I\$(top_srcdir)" + AC_SUBST(SCHRO_CFLAGS) + ++######################## ++# GStreamer stuff ++######################## ++ ++GST_MAJORMINOR=0.10 ++AC_SUBST(GST_MAJORMINOR) ++dnl *** check for arguments to configure *** ++ ++if test "x$with_opengl" = xyes; then ++ GST_GL_DEP="gst-plugins-gl-0.10" ++fi ++ ++AC_ARG_ENABLE(gstreamer, AC_HELP_STRING([--disable-gstreamer], ++ [disable gstreamer support (default=enabled)])) ++if test "x$enable_gstreamer" != xno ++then ++ PKG_CHECK_MODULES(GST, gstreamer-0.10 >= 0.10.19 gstreamer-base-0.10 >= 0.10.19 gstreamer-video-0.10 >= 0.10.19 ${GST_GL_DEP}, ++ HAVE_GST=yes, HAVE_GST=no) ++else ++ HAVE_GST=no ++fi ++ ++AM_CONDITIONAL(HAVE_GST, test "x$HAVE_GST" = "xyes") ++AC_SUBST(GST_CFLAGS) ++AC_SUBST(GST_LIBS) ++ ++plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR" ++AC_SUBST(plugindir) ++ ++GST_ALL_LDFLAGS="-no-undefined" ++AC_SUBST(GST_ALL_LDFLAGS) ++ ++GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^[_]*gst_plugin_desc\$\$' $GST_ALL_LDFLAGS" ++AC_SUBST(GST_PLUGIN_LDFLAGS) ++ ++AC_DEFINE(GST_PACKAGE_ORIGIN, "unknown", [Package origin in GStreamer plugin]) ++ ++AC_ARG_ENABLE(video-compat, AC_HELP_STRING([--disable-video-compat], ++ [disable gstvideo compatibility (default=enabled)])) ++AM_CONDITIONAL(ENABLE_VIDEO_COMPAT, test "x$enable_video_compat" != "xno") ++ + + ######################## + # Check for CUDA +@@ -238,6 +279,8 @@ + schroedinger/Makefile + schroedinger/cuda/Makefile + schroedinger/opengl/Makefile ++gst-libs/gst/video/Makefile ++gst/Makefile + testsuite/Makefile + testsuite/cache/Makefile + testsuite/cuda/Makefile +--- schroedinger-1.0.8.orig/Makefile.am 2009-09-29 07:08:51.000000000 +0200 ++++ schroedinger-1.0.8/Makefile.am 2009-04-22 04:35:57.000000000 +0200 +@@ -4,7 +4,11 @@ + + DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc + +-DIST_SUBDIRS = schroedinger doc tools testsuite ++if HAVE_GST ++SUBDIRS += gst-libs/gst/video gst ++endif ++ ++DIST_SUBDIRS = schroedinger doc tools gst testsuite gst-libs/gst/video + + EXTRA_DIST = COPYING COPYING.GPL COPYING.LGPL COPYING.MIT COPYING.MPL \ + autogen.sh schroedinger.spec TODO NEWS diff --git a/import.log b/import.log index 4bdf783..8d0d441 100644 --- a/import.log +++ b/import.log @@ -1 +1,2 @@ schroedinger-1_0_8-3_fc11:HEAD:schroedinger-1.0.8-3.fc11.src.rpm:1256685452 +schroedinger-1_0_8-3_fc11:HEAD:schroedinger-1.0.8-3.fc11.src.rpm:1256685961 diff --git a/schroedinger.spec b/schroedinger.spec index d4556cf..5bd75d7 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.8 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -10,17 +10,17 @@ Group: System Environment/Libraries License: GPL+ or LGPLv2+ or MIT or MPLv1.1 URL: http://www.diracvideo.org/ Source0: http://www.diracvideo.org/download/schroedinger/schroedinger-%{version}.tar.gz +Patch0: gst-plugins-schroedinger-1.0.8.patch +Patch1: gst-plugins-schroedinger-plug.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: libtool +BuildRequires: glew-devel BuildRequires: liboil-devel >= 0.3.16 -BuildRequires: glew-devel >= 1.5.1 BuildRequires: gstreamer-devel >= 0.10 BuildRequires: gstreamer-plugins-base-devel >= 0.10 BuildRequires: gtk-doc -#Moved to -bad - need to be investigated. -Obsoletes: gstreamer-plugins-schroedinger < %{version} - %description The Schrödinger project will implement portable libraries for the high quality Dirac video codec created by BBC Research and @@ -41,12 +41,31 @@ Requires: liboil-devel >= 0.3.16 %description devel Development files for schroedinger +%package -n gstreamer-plugins-schroedinger +Group: Applications/Multimedia +Summary: GStreamer Plugins that implement Dirac video encoding and decoding + +%description -n gstreamer-plugins-schroedinger +GStreamer Plugins that implement Dirac video encoding and decoding %prep %setup -q +%patch0 -p1 +%patch1 -p1 -b .plug + +autoreconf -vif + %build %configure --disable-static --enable-gtk-doc + +# hack to define the package name +echo "#define GST_PACKAGE_NAME \"gst-plugins-schroedinger fedora rpm\"" >> config.h + +# remove rpath from libtool +sed -i.rpath 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool +sed -i.rpath 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool + make %{?_smp_mflags} %install @@ -73,8 +92,16 @@ rm -rf %{buildroot} %{_libdir}/*.so %{_libdir}/pkgconfig/schroedinger-%{abi}.pc +%files -n gstreamer-plugins-schroedinger +%defattr(-,root,root,-) +%{_libdir}/gstreamer-0.10/libgstschro.so +%exclude %{_libdir}/libgstbasevideo-0.10.a +%exclude %{_includedir}/gstreamer-0.10 %changelog +* Sun Oct 25 2009 kwizart < kwizart at gmail.com > - 1.0.8-3 +- Re-introduce gstreamer sub-package until seen in -good + * Tue Oct 20 2009 kwizart < kwizart at gmail.com > - 1.0.8-2 - Update to 1.0.8 - gstreamer-plugins-schroedinger is now in bad. From cf134eea474df6bc2af530fc7828ca826d962650 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Wed, 28 Oct 2009 00:05:30 +0000 Subject: [PATCH 20/57] Clean noise --- schroedinger.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index 5bd75d7..779925e 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -15,8 +15,9 @@ Patch1: gst-plugins-schroedinger-plug.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: libtool -BuildRequires: glew-devel + BuildRequires: liboil-devel >= 0.3.16 +BuildRequires: glew-devel >= 1.5.1 BuildRequires: gstreamer-devel >= 0.10 BuildRequires: gstreamer-plugins-base-devel >= 0.10 BuildRequires: gtk-doc From 44465f6562a22e2fa7749b33a1fb964bece57b94 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 25 Nov 2009 23:15:23 +0000 Subject: [PATCH 21/57] Fix typo that causes a failure to update the common directory. (releng #2781) --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 27e51f6..0ebb7e9 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ # Makefile for source rpm: schroedinger -# $Id$ +# $Id: Makefile,v 1.1 2007/06/20 16:44:54 kevin Exp $ NAME := schroedinger SPECFILE = $(firstword $(wildcard *.spec)) define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done +for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done endef MAKEFILE_COMMON := $(shell $(find-makefile-common)) From f1e0e3ba4057a3561c8e2a6a40fe10e015845ffe Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Mon, 1 Feb 2010 11:20:20 +0000 Subject: [PATCH 22/57] - Remove obsoleted gst plugin --- gst-plugins-schroedinger-1.0.8.patch | 6504 -------------------------- gst-plugins-schroedinger-plug.patch | 74 - schroedinger.spec | 32 +- 3 files changed, 6 insertions(+), 6604 deletions(-) delete mode 100644 gst-plugins-schroedinger-1.0.8.patch delete mode 100644 gst-plugins-schroedinger-plug.patch diff --git a/gst-plugins-schroedinger-1.0.8.patch b/gst-plugins-schroedinger-1.0.8.patch deleted file mode 100644 index 1b31ede..0000000 --- a/gst-plugins-schroedinger-1.0.8.patch +++ /dev/null @@ -1,6504 +0,0 @@ -diff -uNr schroedinger-1.0.8.orig/gst/gstschro.c schroedinger-1.0.8/gst/gstschro.c ---- schroedinger-1.0.8.orig/gst/gstschro.c 1970-01-01 01:00:00.000000000 +0100 -+++ schroedinger-1.0.8/gst/gstschro.c 2009-09-11 17:35:39.000000000 +0200 -@@ -0,0 +1,54 @@ -+/* GStreamer -+ * Copyright (C) 2005 David Schleef -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Library General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Library General Public License for more details. -+ * -+ * You should have received a copy of the GNU Library 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. -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+ -+#include -+#include -+ -+GType gst_schro_enc_get_type (void); -+GType gst_schro_dec_get_type (void); -+GType gst_schro_parse_get_type (void); -+ -+GST_DEBUG_CATEGORY (schro_debug); -+#define GST_CAT_DEFAULT schro_debug -+ -+static gboolean -+plugin_init (GstPlugin * plugin) -+{ -+ schro_init (); -+ -+ GST_DEBUG_CATEGORY_INIT (schro_debug, "schro", 0, "Schroedinger"); -+ gst_element_register (plugin, "schrodec", GST_RANK_PRIMARY, -+ gst_schro_dec_get_type ()); -+ gst_element_register (plugin, "schroparse", GST_RANK_NONE, -+ gst_schro_parse_get_type ()); -+ gst_element_register (plugin, "schroenc", GST_RANK_PRIMARY, -+ gst_schro_enc_get_type ()); -+ -+ return TRUE; -+} -+ -+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, -+ GST_VERSION_MINOR, -+ "schro", -+ "Schroedinger plugin", -+ plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) -diff -uNr schroedinger-1.0.8.orig/gst/gstschrodec.c schroedinger-1.0.8/gst/gstschrodec.c ---- schroedinger-1.0.8.orig/gst/gstschrodec.c 1970-01-01 01:00:00.000000000 +0100 -+++ schroedinger-1.0.8/gst/gstschrodec.c 2009-10-12 12:23:39.000000000 +0200 -@@ -0,0 +1,728 @@ -+/* Schrodinger -+ * Copyright (C) 2006 David Schleef -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Library General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Library General Public License for more details. -+ * -+ * You should have received a copy of the GNU Library 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. -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "gstschroutils.h" -+ -+#include -+ -+GST_DEBUG_CATEGORY_EXTERN (schro_debug); -+#define GST_CAT_DEFAULT schro_debug -+ -+#define GST_TYPE_SCHRO_DEC \ -+ (gst_schro_dec_get_type()) -+#define GST_SCHRO_DEC(obj) \ -+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SCHRO_DEC,GstSchroDec)) -+#define GST_SCHRO_DEC_CLASS(klass) \ -+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SCHRO_DEC,GstSchroDecClass)) -+#define GST_IS_SCHRO_DEC(obj) \ -+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SCHRO_DEC)) -+#define GST_IS_SCHRO_DEC_CLASS(obj) \ -+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SCHRO_DEC)) -+ -+typedef struct _GstSchroDec GstSchroDec; -+typedef struct _GstSchroDecClass GstSchroDecClass; -+ -+struct _GstSchroDec -+{ -+ GstBaseVideoDecoder base_video_decoder; -+ -+ SchroDecoder *decoder; -+ -+ GstBuffer *seq_header_buffer; -+}; -+ -+struct _GstSchroDecClass -+{ -+ GstBaseVideoDecoder base_video_decoder_class; -+}; -+ -+ -+/* GstSchroDec signals and args */ -+enum -+{ -+ LAST_SIGNAL -+}; -+ -+enum -+{ -+ ARG_0 -+}; -+ -+static void gst_schro_dec_finalize (GObject * object); -+static void gst_schro_dec_set_property (GObject * object, guint prop_id, -+ const GValue * value, GParamSpec * pspec); -+static void gst_schro_dec_get_property (GObject * object, guint prop_id, -+ GValue * value, GParamSpec * pspec); -+ -+static gboolean gst_schro_dec_sink_query (GstPad * pad, GstQuery * query); -+ -+static gboolean gst_schro_dec_start (GstBaseVideoDecoder * dec); -+static gboolean gst_schro_dec_stop (GstBaseVideoDecoder * dec); -+static gboolean gst_schro_dec_reset (GstBaseVideoDecoder * dec); -+static GstFlowReturn gst_schro_dec_parse_data (GstBaseVideoDecoder * -+ base_video_decoder, gboolean at_eos); -+static int gst_schro_dec_scan_for_sync (GstBaseVideoDecoder * -+ base_video_decoder, gboolean at_eos, int offset, int n); -+static GstFlowReturn gst_schro_dec_handle_frame (GstBaseVideoDecoder * decoder, -+ GstVideoFrame * frame); -+static GstFlowReturn gst_schro_dec_finish (GstBaseVideoDecoder * -+ base_video_decoder, GstVideoFrame * frame); -+static void gst_schrodec_send_tags (GstSchroDec * schro_dec); -+ -+static GstStaticPadTemplate gst_schro_dec_sink_template = -+GST_STATIC_PAD_TEMPLATE ("sink", -+ GST_PAD_SINK, -+ GST_PAD_ALWAYS, -+ GST_STATIC_CAPS ("video/x-dirac") -+ ); -+ -+static GstStaticPadTemplate gst_schro_dec_src_template = -+GST_STATIC_PAD_TEMPLATE ("src", -+ GST_PAD_SRC, -+ GST_PAD_ALWAYS, -+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YUY2, AYUV }")) -+ ); -+ -+GST_BOILERPLATE (GstSchroDec, gst_schro_dec, GstBaseVideoDecoder, -+ GST_TYPE_BASE_VIDEO_DECODER); -+ -+static void -+gst_schro_dec_base_init (gpointer g_class) -+{ -+ static GstElementDetails compress_details = -+ GST_ELEMENT_DETAILS ("Dirac Decoder", -+ "Codec/Decoder/Video", -+ "Decode Dirac streams", -+ "David Schleef "); -+ GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); -+ -+ gst_element_class_add_pad_template (element_class, -+ gst_static_pad_template_get (&gst_schro_dec_src_template)); -+ gst_element_class_add_pad_template (element_class, -+ gst_static_pad_template_get (&gst_schro_dec_sink_template)); -+ -+ gst_element_class_set_details (element_class, &compress_details); -+} -+ -+static void -+gst_schro_dec_class_init (GstSchroDecClass * klass) -+{ -+ GObjectClass *gobject_class; -+ GstBaseVideoDecoderClass *base_video_decoder_class; -+ GstElementClass *element_class; -+ -+ gobject_class = G_OBJECT_CLASS (klass); -+ element_class = GST_ELEMENT_CLASS (klass); -+ base_video_decoder_class = GST_BASE_VIDEO_DECODER_CLASS (klass); -+ -+ gobject_class->set_property = gst_schro_dec_set_property; -+ gobject_class->get_property = gst_schro_dec_get_property; -+ gobject_class->finalize = gst_schro_dec_finalize; -+ -+ base_video_decoder_class->start = GST_DEBUG_FUNCPTR (gst_schro_dec_start); -+ base_video_decoder_class->stop = GST_DEBUG_FUNCPTR (gst_schro_dec_stop); -+ base_video_decoder_class->reset = GST_DEBUG_FUNCPTR (gst_schro_dec_reset); -+ base_video_decoder_class->parse_data = -+ GST_DEBUG_FUNCPTR (gst_schro_dec_parse_data); -+ base_video_decoder_class->scan_for_sync = -+ GST_DEBUG_FUNCPTR (gst_schro_dec_scan_for_sync); -+ base_video_decoder_class->handle_frame = -+ GST_DEBUG_FUNCPTR (gst_schro_dec_handle_frame); -+ base_video_decoder_class->finish = GST_DEBUG_FUNCPTR (gst_schro_dec_finish); -+} -+ -+static void -+gst_schro_dec_init (GstSchroDec * schro_dec, GstSchroDecClass * klass) -+{ -+ GST_DEBUG ("gst_schro_dec_init"); -+ -+ gst_pad_set_query_function (GST_BASE_VIDEO_CODEC_SINK_PAD (schro_dec), -+ gst_schro_dec_sink_query); -+ -+ schro_dec->decoder = schro_decoder_new (); -+} -+ -+#define OGG_DIRAC_GRANULE_SHIFT 22 -+#define OGG_DIRAC_GRANULE_LOW_MASK ((1ULL<> 22) + (granulepos & OGG_DIRAC_GRANULE_LOW_MASK)) >> 9; -+ dist_h = (granulepos >> 22) & 0xff; -+ dist_l = granulepos & 0xff; -+ dist = (dist_h << 8) | dist_l; -+ delay = (granulepos >> 9) & 0x1fff; -+ dt = pt - delay; -+ -+ return pt >> 1; -+} -+ -+static gboolean -+gst_schro_dec_sink_convert (GstPad * pad, -+ GstFormat src_format, gint64 src_value, -+ GstFormat * dest_format, gint64 * dest_value) -+{ -+ gboolean res = TRUE; -+ GstSchroDec *dec; -+ GstVideoState *state; -+ -+ if (src_format == *dest_format) { -+ *dest_value = src_value; -+ return TRUE; -+ } -+ -+ dec = GST_SCHRO_DEC (gst_pad_get_parent (pad)); -+ -+ /* FIXME: check if we are in a decoding state */ -+ -+ state = gst_base_video_decoder_get_state (GST_BASE_VIDEO_DECODER (dec)); -+ -+ res = FALSE; -+ if (src_format == GST_FORMAT_DEFAULT && *dest_format == GST_FORMAT_TIME) { -+ if (state->fps_d != 0) { -+ *dest_value = gst_util_uint64_scale (granulepos_to_frame (src_value), -+ state->fps_d * GST_SECOND, state->fps_n); -+ res = TRUE; -+ } else { -+ res = FALSE; -+ } -+ } -+ -+ gst_object_unref (dec); -+ -+ return res; -+} -+ -+static gboolean -+gst_schro_dec_sink_query (GstPad * pad, GstQuery * query) -+{ -+ GstSchroDec *dec; -+ gboolean res = FALSE; -+ -+ dec = GST_SCHRO_DEC (gst_pad_get_parent (pad)); -+ -+ switch (GST_QUERY_TYPE (query)) { -+ case GST_QUERY_CONVERT: -+ { -+ GstFormat src_fmt, dest_fmt; -+ gint64 src_val, dest_val; -+ -+ gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); -+ res = gst_schro_dec_sink_convert (pad, src_fmt, src_val, &dest_fmt, -+ &dest_val); -+ if (!res) -+ goto error; -+ gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); -+ break; -+ } -+ default: -+ res = gst_pad_query_default (pad, query); -+ break; -+ } -+done: -+ gst_object_unref (dec); -+ -+ return res; -+error: -+ GST_DEBUG_OBJECT (dec, "query failed"); -+ goto done; -+} -+ -+static gboolean -+gst_schro_dec_start (GstBaseVideoDecoder * dec) -+{ -+ if (dec->codec_data) { -+ GST_DEBUG_OBJECT (dec, "codec data!"); -+ } -+ -+ return TRUE; -+} -+ -+static gboolean -+gst_schro_dec_stop (GstBaseVideoDecoder * dec) -+{ -+ -+ return TRUE; -+} -+ -+static gboolean -+gst_schro_dec_reset (GstBaseVideoDecoder * dec) -+{ -+ GstSchroDec *schro_dec; -+ -+ schro_dec = GST_SCHRO_DEC (dec); -+ -+ GST_DEBUG ("reset"); -+ -+ if (schro_dec->decoder) { -+ schro_decoder_reset (schro_dec->decoder); -+ } -+ -+ return TRUE; -+} -+ -+static void -+gst_schro_dec_finalize (GObject * object) -+{ -+ GstSchroDec *schro_dec; -+ -+ g_return_if_fail (GST_IS_SCHRO_DEC (object)); -+ schro_dec = GST_SCHRO_DEC (object); -+ -+ if (schro_dec->decoder) { -+ schro_decoder_free (schro_dec->decoder); -+ schro_dec->decoder = NULL; -+ } -+ -+ G_OBJECT_CLASS (parent_class)->finalize (object); -+} -+ -+static void -+gst_schro_dec_set_property (GObject * object, guint prop_id, -+ const GValue * value, GParamSpec * pspec) -+{ -+ GstSchroDec *src; -+ -+ g_return_if_fail (GST_IS_SCHRO_DEC (object)); -+ src = GST_SCHRO_DEC (object); -+ -+ GST_DEBUG ("gst_schro_dec_set_property"); -+ switch (prop_id) { -+ default: -+ break; -+ } -+} -+ -+static void -+gst_schro_dec_get_property (GObject * object, guint prop_id, GValue * value, -+ GParamSpec * pspec) -+{ -+ GstSchroDec *src; -+ -+ g_return_if_fail (GST_IS_SCHRO_DEC (object)); -+ src = GST_SCHRO_DEC (object); -+ -+ switch (prop_id) { -+ default: -+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); -+ break; -+ } -+} -+ -+static void -+parse_sequence_header (GstSchroDec * schro_dec, guint8 * data, int size) -+{ -+ SchroVideoFormat video_format; -+ int ret; -+ GstVideoState *state; -+ -+ GST_DEBUG_OBJECT (schro_dec, "parse_sequence_header size=%d", size); -+ -+ state = gst_base_video_decoder_get_state (GST_BASE_VIDEO_DECODER (schro_dec)); -+ -+ schro_dec->seq_header_buffer = gst_buffer_new_and_alloc (size); -+ memcpy (GST_BUFFER_DATA (schro_dec->seq_header_buffer), data, size); -+ -+ ret = schro_parse_decode_sequence_header (data + 13, size - 13, -+ &video_format); -+ if (ret) { -+ if (video_format.chroma_format == SCHRO_CHROMA_444) { -+ state->format = GST_VIDEO_FORMAT_AYUV; -+ } else if (video_format.chroma_format == SCHRO_CHROMA_422) { -+ state->format = GST_VIDEO_FORMAT_YUY2; -+ } else if (video_format.chroma_format == SCHRO_CHROMA_420) { -+ state->format = GST_VIDEO_FORMAT_I420; -+ } -+ state->fps_n = video_format.frame_rate_numerator; -+ state->fps_d = video_format.frame_rate_denominator; -+ GST_DEBUG_OBJECT (schro_dec, "Frame rate is %d/%d", state->fps_n, -+ state->fps_d); -+ -+ state->width = video_format.width; -+ state->height = video_format.height; -+ GST_DEBUG ("Frame dimensions are %d x %d\n", state->width, state->height); -+ -+ state->clean_width = video_format.clean_width; -+ state->clean_height = video_format.clean_height; -+ state->clean_offset_left = video_format.left_offset; -+ state->clean_offset_top = video_format.top_offset; -+ -+ state->par_n = video_format.aspect_ratio_numerator; -+ state->par_d = video_format.aspect_ratio_denominator; -+ GST_DEBUG ("Pixel aspect ratio is %d/%d", state->par_n, state->par_d); -+ -+ /* FIXME state points to what is actually in the decoder */ -+ //gst_base_video_decoder_set_state (GST_BASE_VIDEO_DECODER (schro_dec), -+ // state); -+ } else { -+ GST_WARNING ("Failed to get frame rate from sequence header"); -+ } -+ -+ gst_schrodec_send_tags (schro_dec); -+} -+ -+ -+static GstFlowReturn -+gst_schro_dec_parse_data (GstBaseVideoDecoder * base_video_decoder, -+ gboolean at_eos) -+{ -+ GstSchroDec *schro_decoder; -+ unsigned char header[SCHRO_PARSE_HEADER_SIZE]; -+ int next; -+ int prev; -+ int parse_code; -+ -+ GST_DEBUG_OBJECT (base_video_decoder, "parse_data"); -+ -+ schro_decoder = GST_SCHRO_DEC (base_video_decoder); -+ -+ if (gst_adapter_available (base_video_decoder->input_adapter) < -+ SCHRO_PARSE_HEADER_SIZE) { -+ return GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA; -+ } -+ -+ GST_DEBUG ("available %d", -+ gst_adapter_available (base_video_decoder->input_adapter)); -+ -+ gst_adapter_copy (base_video_decoder->input_adapter, header, 0, -+ SCHRO_PARSE_HEADER_SIZE); -+ -+ parse_code = header[4]; -+ next = GST_READ_UINT32_BE (header + 5); -+ prev = GST_READ_UINT32_BE (header + 9); -+ -+ GST_DEBUG ("%08x %02x %08x %08x", -+ GST_READ_UINT32_BE (header), parse_code, next, prev); -+ -+ if (memcmp (header, "BBCD", 4) != 0 || -+ (next & 0xf0000000) || (prev & 0xf0000000)) { -+ gst_base_video_decoder_lost_sync (base_video_decoder); -+ return GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA; -+ } -+ -+ if (SCHRO_PARSE_CODE_IS_END_OF_SEQUENCE (parse_code)) { -+ GstVideoFrame *frame; -+ -+ if (next != 0 && next != SCHRO_PARSE_HEADER_SIZE) { -+ GST_WARNING ("next is not 0 or 13 in EOS packet (%d)", next); -+ } -+ -+ gst_base_video_decoder_add_to_frame (base_video_decoder, -+ SCHRO_PARSE_HEADER_SIZE); -+ -+ frame = base_video_decoder->current_frame; -+ frame->is_eos = TRUE; -+ -+ SCHRO_DEBUG ("eos"); -+ -+ return gst_base_video_decoder_have_frame (base_video_decoder); -+ } -+ -+ if (gst_adapter_available (base_video_decoder->input_adapter) < next) { -+ return GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA; -+ } -+ -+ if (SCHRO_PARSE_CODE_IS_SEQ_HEADER (parse_code)) { -+ guint8 *data; -+ -+ data = g_malloc (next); -+ -+ gst_adapter_copy (base_video_decoder->input_adapter, data, 0, next); -+ parse_sequence_header (schro_decoder, data, next); -+ -+ gst_base_video_decoder_set_sync_point (base_video_decoder); -+ -+ if (GST_CLOCK_TIME_IS_VALID (base_video_decoder->last_sink_timestamp)) { -+ base_video_decoder->current_frame->presentation_timestamp = -+ base_video_decoder->last_sink_timestamp; -+ GST_DEBUG ("got timestamp %" G_GINT64_FORMAT, -+ base_video_decoder->last_sink_timestamp); -+ } else if (base_video_decoder->last_sink_offset_end != -1) { -+ GstVideoState *state; -+ -+#if 0 -+ /* FIXME perhaps should use this to determine if the granulepos -+ * is valid */ -+ { -+ guint64 pt; -+ int dist_h; -+ int dist_l; -+ int dist; -+ int delay; -+ guint64 dt; -+ gint64 granulepos = base_video_decoder->last_sink_offset_end; -+ -+ pt = ((granulepos >> 22) + -+ (granulepos & OGG_DIRAC_GRANULE_LOW_MASK)) >> 9; -+ dist_h = (granulepos >> 22) & 0xff; -+ dist_l = granulepos & 0xff; -+ dist = (dist_h << 8) | dist_l; -+ delay = (granulepos >> 9) & 0x1fff; -+ dt = pt - delay; -+ GST_DEBUG ("gp pt %lld dist %d delay %d dt %lld", pt, dist, delay, dt); -+ } -+#endif -+ state = -+ gst_base_video_decoder_get_state (GST_BASE_VIDEO_DECODER -+ (schro_decoder)); -+ base_video_decoder->current_frame->presentation_timestamp = -+ gst_util_uint64_scale (granulepos_to_frame -+ (base_video_decoder->last_sink_offset_end), state->fps_d * GST_SECOND, -+ state->fps_n); -+ } else { -+ base_video_decoder->current_frame->presentation_timestamp = -1; -+ } -+ -+ g_free (data); -+ } -+ -+ if (schro_decoder->seq_header_buffer == NULL) { -+ gst_adapter_flush (base_video_decoder->input_adapter, next); -+ return GST_FLOW_OK; -+ } -+ -+ if (SCHRO_PARSE_CODE_IS_PICTURE (parse_code)) { -+ GstVideoFrame *frame; -+ guint8 tmp[4]; -+ -+ frame = base_video_decoder->current_frame; -+ -+ gst_adapter_copy (base_video_decoder->input_adapter, tmp, -+ SCHRO_PARSE_HEADER_SIZE, 4); -+ -+ frame->presentation_frame_number = GST_READ_UINT32_BE (tmp); -+ -+ gst_base_video_decoder_add_to_frame (base_video_decoder, next); -+ -+ return gst_base_video_decoder_have_frame (base_video_decoder); -+ } else { -+ gst_base_video_decoder_add_to_frame (base_video_decoder, next); -+ } -+ -+ return GST_FLOW_OK; -+} -+ -+static int -+gst_schro_dec_scan_for_sync (GstBaseVideoDecoder * base_video_decoder, -+ gboolean at_eos, int offset, int n) -+{ -+ GstAdapter *adapter = base_video_decoder->input_adapter; -+ int n_available; -+ int ret; -+ -+ n_available = gst_adapter_available (adapter) - offset; -+ -+ if (n_available < 4) { -+ if (at_eos) { -+ return n_available; -+ } else { -+ return 0; -+ } -+ } -+ -+ n = MIN (n, n_available - 3); -+ -+ ret = gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x42424344, -+ offset, n); -+ if (ret == -1) { -+ return n; -+ } -+ return ret; -+} -+ -+ -+static void -+gst_schrodec_send_tags (GstSchroDec * schro_dec) -+{ -+ GstTagList *list; -+ -+ list = gst_tag_list_new (); -+ gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, -+ GST_TAG_VIDEO_CODEC, "Dirac", NULL); -+ -+ gst_element_found_tags_for_pad (GST_ELEMENT_CAST (schro_dec), -+ GST_BASE_VIDEO_CODEC_SRC_PAD (schro_dec), list); -+} -+ -+static GstFlowReturn -+gst_schro_dec_process (GstSchroDec * schro_dec, gboolean eos) -+{ -+ gboolean go; -+ GstFlowReturn ret; -+ -+ ret = GST_FLOW_OK; -+ go = TRUE; -+ while (go) { -+ int it; -+ -+ it = schro_decoder_autoparse_wait (schro_dec->decoder); -+ -+ switch (it) { -+ case SCHRO_DECODER_FIRST_ACCESS_UNIT: -+ break; -+ case SCHRO_DECODER_NEED_BITS: -+ GST_DEBUG ("need bits"); -+ go = 0; -+ break; -+ case SCHRO_DECODER_NEED_FRAME: -+ { -+ GstBuffer *outbuf; -+ GstVideoState *state; -+ SchroFrame *schro_frame; -+ GstFlowReturn flow_ret; -+ int size; -+ -+ GST_DEBUG ("need frame"); -+ -+ state = -+ gst_base_video_decoder_get_state (GST_BASE_VIDEO_DECODER -+ (schro_dec)); -+ size = -+ gst_video_format_get_size (state->format, state->width, -+ state->height); -+ flow_ret = -+ gst_pad_alloc_buffer_and_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD -+ (schro_dec), GST_BUFFER_OFFSET_NONE, size, -+ GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (schro_dec)), &outbuf); -+ if (flow_ret != GST_FLOW_OK) { -+ go = FALSE; -+ ret = flow_ret; -+ break; -+ } -+ schro_frame = gst_schro_buffer_wrap (outbuf, -+ state->format, state->width, state->height); -+ schro_decoder_add_output_picture (schro_dec->decoder, schro_frame); -+ break; -+ } -+ case SCHRO_DECODER_OK: -+ { -+ SchroFrame *schro_frame; -+ SchroTag *tag; -+ GstVideoFrame *frame; -+ -+ GST_DEBUG ("got frame"); -+ -+ tag = schro_decoder_get_picture_tag (schro_dec->decoder); -+ schro_frame = schro_decoder_pull (schro_dec->decoder); -+ frame = tag->value; -+ -+ if (schro_frame) { -+ if (schro_frame->priv) { -+ GstFlowReturn flow_ret; -+ -+ frame->src_buffer = gst_buffer_ref (GST_BUFFER (schro_frame->priv)); -+ -+ flow_ret = -+ gst_base_video_decoder_finish_frame (GST_BASE_VIDEO_DECODER -+ (schro_dec), frame); -+ if (flow_ret != GST_FLOW_OK) { -+ GST_DEBUG ("finish frame returned %d", flow_ret); -+ return flow_ret; -+ } -+ } else { -+ GST_DEBUG ("skipped frame"); -+ } -+ -+ schro_frame_unref (schro_frame); -+ } -+ if (!eos) { -+ go = FALSE; -+ } -+ } -+ -+ break; -+ case SCHRO_DECODER_EOS: -+ GST_DEBUG ("eos"); -+ go = FALSE; -+ break; -+ case SCHRO_DECODER_ERROR: -+ go = FALSE; -+ GST_DEBUG ("codec error"); -+ ret = GST_FLOW_ERROR; -+ break; -+ } -+ } -+ return ret; -+} -+ -+GstFlowReturn -+gst_schro_dec_handle_frame (GstBaseVideoDecoder * base_video_decoder, -+ GstVideoFrame * frame) -+{ -+ GstSchroDec *schro_dec; -+ int schro_ret; -+ SchroBuffer *input_buffer; -+ GstVideoState *state; -+ -+ schro_dec = GST_SCHRO_DEC (base_video_decoder); -+ -+ GST_DEBUG ("handle frame"); -+ -+ state = gst_base_video_decoder_get_state (base_video_decoder); -+ -+ gst_base_video_decoder_set_src_caps (base_video_decoder); -+ -+ input_buffer = gst_schro_wrap_gst_buffer (frame->sink_buffer); -+ frame->sink_buffer = NULL; -+ -+ input_buffer->tag = schro_tag_new (frame, NULL); -+ -+ schro_ret = schro_decoder_autoparse_push (schro_dec->decoder, input_buffer); -+ -+ return gst_schro_dec_process (schro_dec, FALSE); -+} -+ -+GstFlowReturn -+gst_schro_dec_finish (GstBaseVideoDecoder * base_video_decoder, -+ GstVideoFrame * frame) -+{ -+ GstSchroDec *schro_dec; -+ -+ schro_dec = GST_SCHRO_DEC (base_video_decoder); -+ -+ GST_DEBUG ("finish"); -+ -+ gst_base_video_decoder_set_src_caps (base_video_decoder); -+ -+ schro_decoder_autoparse_push_end_of_sequence (schro_dec->decoder); -+ -+ return gst_schro_dec_process (schro_dec, TRUE); -+} -diff -uNr schroedinger-1.0.8.orig/gst/gstschroenc.c schroedinger-1.0.8/gst/gstschroenc.c ---- schroedinger-1.0.8.orig/gst/gstschroenc.c 1970-01-01 01:00:00.000000000 +0100 -+++ schroedinger-1.0.8/gst/gstschroenc.c 2009-10-23 22:02:51.000000000 +0200 -@@ -0,0 +1,791 @@ -+/* Schrodinger -+ * Copyright (C) 2006 David Schleef -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Library General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Library General Public License for more details. -+ * -+ * You should have received a copy of the GNU Library 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. -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include "gstschroutils.h" -+ -+GST_DEBUG_CATEGORY_EXTERN (schro_debug); -+#define GST_CAT_DEFAULT schro_debug -+ -+#define GST_TYPE_SCHRO_ENC \ -+ (gst_schro_enc_get_type()) -+#define GST_SCHRO_ENC(obj) \ -+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SCHRO_ENC,GstSchroEnc)) -+#define GST_SCHRO_ENC_CLASS(klass) \ -+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SCHRO_ENC,GstSchroEncClass)) -+#define GST_IS_SCHRO_ENC(obj) \ -+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SCHRO_ENC)) -+#define GST_IS_SCHRO_ENC_CLASS(obj) \ -+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SCHRO_ENC)) -+ -+typedef struct _GstSchroEnc GstSchroEnc; -+typedef struct _GstSchroEncClass GstSchroEncClass; -+ -+typedef enum -+{ -+ GST_SCHRO_ENC_OUTPUT_OGG, -+ GST_SCHRO_ENC_OUTPUT_QUICKTIME, -+ GST_SCHRO_ENC_OUTPUT_AVI, -+ GST_SCHRO_ENC_OUTPUT_MPEG_TS, -+ GST_SCHRO_ENC_OUTPUT_MP4 -+} GstSchroEncOutputType; -+ -+struct _GstSchroEnc -+{ -+ GstBaseVideoEncoder base_encoder; -+ -+ GstPad *sinkpad; -+ GstPad *srcpad; -+ -+ /* video properties */ -+ GstSchroEncOutputType output_format; -+ -+ /* state */ -+ SchroEncoder *encoder; -+ SchroVideoFormat *video_format; -+ GstVideoFrame *eos_frame; -+ GstBuffer *seq_header_buffer; -+ -+ guint64 last_granulepos; -+ guint64 granule_offset; -+}; -+ -+struct _GstSchroEncClass -+{ -+ GstBaseVideoEncoderClass parent_class; -+}; -+ -+ -+ -+enum -+{ -+ LAST_SIGNAL -+}; -+ -+enum -+{ -+ ARG_0 -+}; -+ -+static void gst_schro_enc_set_property (GObject * object, guint prop_id, -+ const GValue * value, GParamSpec * pspec); -+static void gst_schro_enc_get_property (GObject * object, guint prop_id, -+ GValue * value, GParamSpec * pspec); -+ -+static GstFlowReturn gst_schro_enc_process (GstSchroEnc * schro_enc); -+ -+static gboolean gst_schro_enc_set_format (GstBaseVideoEncoder * -+ base_video_encoder, GstVideoState * state); -+static gboolean gst_schro_enc_start (GstBaseVideoEncoder * base_video_encoder); -+static gboolean gst_schro_enc_stop (GstBaseVideoEncoder * base_video_encoder); -+static gboolean gst_schro_enc_finish (GstBaseVideoEncoder * base_video_encoder, -+ GstVideoFrame * frame); -+static GstFlowReturn gst_schro_enc_handle_frame (GstBaseVideoEncoder * -+ base_video_encoder, GstVideoFrame * frame); -+static GstFlowReturn gst_schro_enc_shape_output (GstBaseVideoEncoder * -+ base_video_encoder, GstVideoFrame * frame); -+static GstCaps *gst_schro_enc_get_caps (GstBaseVideoEncoder * -+ base_video_encoder); -+ -+static GstStaticPadTemplate gst_schro_enc_sink_template = -+GST_STATIC_PAD_TEMPLATE ("sink", -+ GST_PAD_SINK, -+ GST_PAD_ALWAYS, -+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YV12, YUY2, UYVY, AYUV }")) -+ ); -+ -+static GstStaticPadTemplate gst_schro_enc_src_template = -+ GST_STATIC_PAD_TEMPLATE ("src", -+ GST_PAD_SRC, -+ GST_PAD_ALWAYS, -+ GST_STATIC_CAPS ("video/x-dirac;video/x-qt-part;video/x-mp4-part") -+ ); -+ -+GST_BOILERPLATE (GstSchroEnc, gst_schro_enc, GstBaseVideoEncoder, -+ GST_TYPE_BASE_VIDEO_ENCODER); -+ -+static void -+gst_schro_enc_base_init (gpointer g_class) -+{ -+ static GstElementDetails schro_enc_details = -+ GST_ELEMENT_DETAILS ("Dirac Encoder", -+ "Codec/Encoder/Video", -+ "Encode raw video into Dirac stream", -+ "David Schleef "); -+ GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); -+ -+ gst_element_class_add_pad_template (element_class, -+ gst_static_pad_template_get (&gst_schro_enc_src_template)); -+ gst_element_class_add_pad_template (element_class, -+ gst_static_pad_template_get (&gst_schro_enc_sink_template)); -+ -+ gst_element_class_set_details (element_class, &schro_enc_details); -+} -+ -+static GType -+register_enum_list (const SchroEncoderSetting * setting) -+{ -+ GType type; -+ static GEnumValue *enumtypes; -+ int n; -+ char *typename; -+ int i; -+ -+ n = setting->max + 1; -+ -+ enumtypes = g_malloc0 ((n + 1) * sizeof (GEnumValue)); -+ for (i = 0; i < n; i++) { -+ enumtypes[i].value = i; -+ enumtypes[i].value_name = setting->enum_list[i]; -+ enumtypes[i].value_nick = setting->enum_list[i]; -+ } -+ -+ typename = g_strdup_printf ("SchroEncoderSettingEnum_%s", setting->name); -+ type = g_enum_register_static (typename, enumtypes); -+ g_free (typename); -+ -+ return type; -+} -+ -+static void -+gst_schro_enc_class_init (GstSchroEncClass * klass) -+{ -+ GObjectClass *gobject_class; -+ GstElementClass *gstelement_class; -+ GstBaseVideoEncoderClass *basevideocoder_class; -+ int i; -+ -+ gobject_class = G_OBJECT_CLASS (klass); -+ gstelement_class = GST_ELEMENT_CLASS (klass); -+ basevideocoder_class = GST_BASE_VIDEO_ENCODER_CLASS (klass); -+ -+ gobject_class->set_property = gst_schro_enc_set_property; -+ gobject_class->get_property = gst_schro_enc_get_property; -+ -+ for (i = 0; i < schro_encoder_get_n_settings (); i++) { -+ const SchroEncoderSetting *setting; -+ -+ setting = schro_encoder_get_setting_info (i); -+ -+ switch (setting->type) { -+ case SCHRO_ENCODER_SETTING_TYPE_BOOLEAN: -+ g_object_class_install_property (gobject_class, i + 1, -+ g_param_spec_boolean (setting->name, setting->name, setting->name, -+ setting->default_value, G_PARAM_READWRITE)); -+ break; -+ case SCHRO_ENCODER_SETTING_TYPE_INT: -+ g_object_class_install_property (gobject_class, i + 1, -+ g_param_spec_int (setting->name, setting->name, setting->name, -+ setting->min, setting->max, setting->default_value, -+ G_PARAM_READWRITE)); -+ break; -+ case SCHRO_ENCODER_SETTING_TYPE_ENUM: -+ g_object_class_install_property (gobject_class, i + 1, -+ g_param_spec_enum (setting->name, setting->name, setting->name, -+ register_enum_list (setting), setting->default_value, -+ G_PARAM_READWRITE)); -+ break; -+ case SCHRO_ENCODER_SETTING_TYPE_DOUBLE: -+ g_object_class_install_property (gobject_class, i + 1, -+ g_param_spec_double (setting->name, setting->name, setting->name, -+ setting->min, setting->max, setting->default_value, -+ G_PARAM_READWRITE)); -+ break; -+ default: -+ break; -+ } -+ } -+ -+ basevideocoder_class->set_format = -+ GST_DEBUG_FUNCPTR (gst_schro_enc_set_format); -+ basevideocoder_class->start = GST_DEBUG_FUNCPTR (gst_schro_enc_start); -+ basevideocoder_class->stop = GST_DEBUG_FUNCPTR (gst_schro_enc_stop); -+ basevideocoder_class->finish = GST_DEBUG_FUNCPTR (gst_schro_enc_finish); -+ basevideocoder_class->handle_frame = -+ GST_DEBUG_FUNCPTR (gst_schro_enc_handle_frame); -+ basevideocoder_class->shape_output = -+ GST_DEBUG_FUNCPTR (gst_schro_enc_shape_output); -+ basevideocoder_class->get_caps = GST_DEBUG_FUNCPTR (gst_schro_enc_get_caps); -+} -+ -+static void -+gst_schro_enc_init (GstSchroEnc * schro_enc, GstSchroEncClass * klass) -+{ -+ GST_DEBUG ("gst_schro_enc_init"); -+ -+ /* Normally, we'd create the encoder in ->start(), but we use the -+ * encoder to store object properties. So it needs to be created -+ * here. */ -+ schro_enc->encoder = schro_encoder_new (); -+ schro_encoder_set_packet_assembly (schro_enc->encoder, TRUE); -+ schro_enc->video_format = schro_encoder_get_video_format (schro_enc->encoder); -+} -+ -+ -+ -+static gboolean -+gst_schro_enc_set_format (GstBaseVideoEncoder * base_video_encoder, -+ GstVideoState * state) -+{ -+ GstCaps *caps; -+ GstStructure *structure; -+ GstSchroEnc *schro_enc = GST_SCHRO_ENC (base_video_encoder); -+ -+ GST_DEBUG ("set_output_caps"); -+ caps = -+ gst_pad_get_allowed_caps (GST_BASE_VIDEO_CODEC_SRC_PAD -+ (base_video_encoder)); -+ if (caps == NULL) { -+ caps = -+ gst_caps_copy (gst_pad_get_pad_template_caps -+ (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder))); -+ } -+ -+ if (gst_caps_is_empty (caps)) { -+ gst_caps_unref (caps); -+ return FALSE; -+ } -+ -+ structure = gst_caps_get_structure (caps, 0); -+ -+ if (gst_structure_has_name (structure, "video/x-dirac")) { -+ schro_enc->output_format = GST_SCHRO_ENC_OUTPUT_OGG; -+ } else if (gst_structure_has_name (structure, "video/x-qt-part")) { -+ schro_enc->output_format = GST_SCHRO_ENC_OUTPUT_QUICKTIME; -+ } else if (gst_structure_has_name (structure, "video/x-avi-part")) { -+ schro_enc->output_format = GST_SCHRO_ENC_OUTPUT_AVI; -+ } else if (gst_structure_has_name (structure, "video/x-mp4-part")) { -+ schro_enc->output_format = GST_SCHRO_ENC_OUTPUT_MP4; -+ } else { -+ gst_caps_unref (caps); -+ return FALSE; -+ } -+ -+ gst_caps_unref (caps); -+ -+ gst_base_video_encoder_set_latency_fields (base_video_encoder, -+ 2 * (int) schro_encoder_setting_get_double (schro_enc->encoder, -+ "queue_depth")); -+ -+ schro_video_format_set_std_video_format (schro_enc->video_format, -+ SCHRO_VIDEO_FORMAT_CUSTOM); -+ -+ switch (state->format) { -+ case GST_VIDEO_FORMAT_I420: -+ case GST_VIDEO_FORMAT_YV12: -+ schro_enc->video_format->chroma_format = SCHRO_CHROMA_420; -+ break; -+ case GST_VIDEO_FORMAT_YUY2: -+ case GST_VIDEO_FORMAT_UYVY: -+ schro_enc->video_format->chroma_format = SCHRO_CHROMA_422; -+ break; -+ case GST_VIDEO_FORMAT_AYUV: -+ schro_enc->video_format->chroma_format = SCHRO_CHROMA_444; -+ break; -+ case GST_VIDEO_FORMAT_ARGB: -+ schro_enc->video_format->chroma_format = SCHRO_CHROMA_420; -+ break; -+ default: -+ g_assert_not_reached (); -+ } -+ -+ schro_enc->video_format->frame_rate_numerator = state->fps_n; -+ schro_enc->video_format->frame_rate_denominator = state->fps_d; -+ -+ schro_enc->video_format->width = state->width; -+ schro_enc->video_format->height = state->height; -+ schro_enc->video_format->clean_width = state->clean_width; -+ schro_enc->video_format->clean_height = state->clean_height; -+ schro_enc->video_format->left_offset = state->clean_offset_left; -+ schro_enc->video_format->top_offset = state->clean_offset_top; -+ -+ schro_enc->video_format->aspect_ratio_numerator = state->par_n; -+ schro_enc->video_format->aspect_ratio_denominator = state->par_d; -+ -+ schro_video_format_set_std_signal_range (schro_enc->video_format, -+ SCHRO_SIGNAL_RANGE_8BIT_VIDEO); -+ schro_video_format_set_std_colour_spec (schro_enc->video_format, -+ SCHRO_COLOUR_SPEC_HDTV); -+ -+ schro_encoder_set_video_format (schro_enc->encoder, schro_enc->video_format); -+ schro_encoder_start (schro_enc->encoder); -+ -+ schro_enc->seq_header_buffer = -+ gst_schro_wrap_schro_buffer (schro_encoder_encode_sequence_header -+ (schro_enc->encoder)); -+ -+ return TRUE; -+} -+ -+static void -+gst_schro_enc_set_property (GObject * object, guint prop_id, -+ const GValue * value, GParamSpec * pspec) -+{ -+ GstSchroEnc *src; -+ -+ g_return_if_fail (GST_IS_SCHRO_ENC (object)); -+ src = GST_SCHRO_ENC (object); -+ -+ GST_DEBUG ("gst_schro_enc_set_property"); -+ -+ if (prop_id >= 1) { -+ const SchroEncoderSetting *setting; -+ setting = schro_encoder_get_setting_info (prop_id - 1); -+ switch (G_VALUE_TYPE (value)) { -+ case G_TYPE_DOUBLE: -+ schro_encoder_setting_set_double (src->encoder, setting->name, -+ g_value_get_double (value)); -+ break; -+ case G_TYPE_INT: -+ schro_encoder_setting_set_double (src->encoder, setting->name, -+ g_value_get_int (value)); -+ break; -+ case G_TYPE_BOOLEAN: -+ schro_encoder_setting_set_double (src->encoder, setting->name, -+ g_value_get_boolean (value)); -+ break; -+ default: -+ schro_encoder_setting_set_double (src->encoder, setting->name, -+ g_value_get_enum (value)); -+ break; -+ } -+ } -+} -+ -+static void -+gst_schro_enc_get_property (GObject * object, guint prop_id, GValue * value, -+ GParamSpec * pspec) -+{ -+ GstSchroEnc *src; -+ -+ g_return_if_fail (GST_IS_SCHRO_ENC (object)); -+ src = GST_SCHRO_ENC (object); -+ -+ if (prop_id >= 1) { -+ const SchroEncoderSetting *setting; -+ setting = schro_encoder_get_setting_info (prop_id - 1); -+ switch (G_VALUE_TYPE (value)) { -+ case G_TYPE_DOUBLE: -+ g_value_set_double (value, -+ schro_encoder_setting_get_double (src->encoder, setting->name)); -+ break; -+ case G_TYPE_INT: -+ g_value_set_int (value, -+ schro_encoder_setting_get_double (src->encoder, setting->name)); -+ break; -+ case G_TYPE_BOOLEAN: -+ g_value_set_boolean (value, -+ schro_encoder_setting_get_double (src->encoder, setting->name)); -+ break; -+ default: -+ /* it's an enum */ -+ g_value_set_enum (value, -+ schro_encoder_setting_get_double (src->encoder, setting->name)); -+ break; -+ } -+ } -+} -+ -+static gboolean -+gst_schro_enc_start (GstBaseVideoEncoder * base_video_encoder) -+{ -+ GstSchroEnc *schro_enc = GST_SCHRO_ENC (base_video_encoder); -+ -+ schro_enc->granule_offset = ~0; -+ -+ return TRUE; -+} -+ -+static gboolean -+gst_schro_enc_stop (GstBaseVideoEncoder * base_video_encoder) -+{ -+ GstSchroEnc *schro_enc = GST_SCHRO_ENC (base_video_encoder); -+ -+ if (schro_enc->encoder) { -+ schro_encoder_free (schro_enc->encoder); -+ schro_enc->encoder = NULL; -+ } -+ -+ return TRUE; -+} -+ -+static gboolean -+gst_schro_enc_finish (GstBaseVideoEncoder * base_video_encoder, -+ GstVideoFrame * frame) -+{ -+ GstSchroEnc *schro_enc = GST_SCHRO_ENC (base_video_encoder); -+ -+ GST_DEBUG ("finish"); -+ -+ schro_enc->eos_frame = frame; -+ -+ schro_encoder_end_of_stream (schro_enc->encoder); -+ gst_schro_enc_process (schro_enc); -+ -+ return TRUE; -+} -+ -+static GstFlowReturn -+gst_schro_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder, -+ GstVideoFrame * frame) -+{ -+ GstSchroEnc *schro_enc = GST_SCHRO_ENC (base_video_encoder); -+ SchroFrame *schro_frame; -+ GstFlowReturn ret; -+ const GstVideoState *state; -+ -+ state = gst_base_video_encoder_get_state (base_video_encoder); -+ -+ if (schro_enc->granule_offset == ~0LL) { -+ schro_enc->granule_offset = -+ gst_util_uint64_scale (frame->presentation_timestamp, -+ 2 * state->fps_n, GST_SECOND * state->fps_d); -+ GST_DEBUG ("granule offset %" G_GINT64_FORMAT, schro_enc->granule_offset); -+ } -+ -+ schro_frame = gst_schro_buffer_wrap (gst_buffer_ref (frame->sink_buffer), -+ state->format, state->width, state->height); -+ -+ GST_DEBUG ("pushing frame %p", frame); -+ schro_encoder_push_frame_full (schro_enc->encoder, schro_frame, frame); -+ -+ ret = gst_schro_enc_process (schro_enc); -+ -+ return ret; -+} -+ -+#if 0 -+static void -+gst_caps_add_streamheader (GstCaps * caps, GList * list) -+{ -+ GValue array = { 0 }; -+ GValue value = { 0 }; -+ GstBuffer *buf; -+ GList *g; -+ -+ g_value_init (&array, GST_TYPE_ARRAY); -+ -+ for (g = g_list_first (list); g; g = g_list_next (list)) { -+ g_value_init (&value, GST_TYPE_BUFFER); -+ buf = gst_buffer_copy (GST_BUFFER (g->data)); -+ gst_value_set_buffer (&value, buf); -+ gst_buffer_unref (buf); -+ gst_value_array_append_value (&array, &value); -+ g_value_unset (&value); -+ } -+ gst_structure_set_value (gst_caps_get_structure (caps, 0), -+ "streamheader", &array); -+ g_value_unset (&array); -+} -+#endif -+ -+static GstCaps * -+gst_schro_enc_get_caps (GstBaseVideoEncoder * base_video_encoder) -+{ -+ GstCaps *caps; -+ const GstVideoState *state; -+ GstSchroEnc *schro_enc; -+ -+ schro_enc = GST_SCHRO_ENC (base_video_encoder); -+ -+ state = gst_base_video_encoder_get_state (base_video_encoder); -+ -+ if (schro_enc->output_format == GST_SCHRO_ENC_OUTPUT_OGG) { -+ caps = gst_caps_new_simple ("video/x-dirac", -+ "width", G_TYPE_INT, state->width, -+ "height", G_TYPE_INT, state->height, -+ "framerate", GST_TYPE_FRACTION, state->fps_n, -+ state->fps_d, -+ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, -+ state->par_d, NULL); -+ -+ GST_BUFFER_FLAG_SET (schro_enc->seq_header_buffer, GST_BUFFER_FLAG_IN_CAPS); -+ -+ { -+ GValue array = { 0 }; -+ GValue value = { 0 }; -+ GstBuffer *buf; -+ int size; -+ -+ g_value_init (&array, GST_TYPE_ARRAY); -+ g_value_init (&value, GST_TYPE_BUFFER); -+ size = GST_BUFFER_SIZE (schro_enc->seq_header_buffer); -+ buf = gst_buffer_new_and_alloc (size + SCHRO_PARSE_HEADER_SIZE); -+ -+ /* ogg(mux) expects the header buffers to have 0 timestamps - -+ set OFFSET and OFFSET_END accordingly */ -+ GST_BUFFER_OFFSET (buf) = 0; -+ GST_BUFFER_OFFSET_END (buf) = 0; -+ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS); -+ -+ memcpy (GST_BUFFER_DATA (buf), -+ GST_BUFFER_DATA (schro_enc->seq_header_buffer), size); -+ GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf) + size + 0, 0x42424344); -+ GST_WRITE_UINT8 (GST_BUFFER_DATA (buf) + size + 4, -+ SCHRO_PARSE_CODE_END_OF_SEQUENCE); -+ GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf) + size + 5, 0); -+ GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf) + size + 9, size); -+ gst_value_set_buffer (&value, buf); -+ gst_buffer_unref (buf); -+ gst_value_array_append_value (&array, &value); -+ gst_structure_set_value (gst_caps_get_structure (caps, 0), -+ "streamheader", &array); -+ g_value_unset (&value); -+ g_value_unset (&array); -+ } -+ } else if (schro_enc->output_format == GST_SCHRO_ENC_OUTPUT_QUICKTIME) { -+ caps = gst_caps_new_simple ("video/x-qt-part", -+ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'), -+ "width", G_TYPE_INT, state->width, -+ "height", G_TYPE_INT, state->height, -+ "framerate", GST_TYPE_FRACTION, state->fps_n, -+ state->fps_d, -+ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, -+ state->par_d, NULL); -+ } else if (schro_enc->output_format == GST_SCHRO_ENC_OUTPUT_AVI) { -+ caps = gst_caps_new_simple ("video/x-avi-part", -+ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'), -+ "width", G_TYPE_INT, state->width, -+ "height", G_TYPE_INT, state->height, -+ "framerate", GST_TYPE_FRACTION, state->fps_n, -+ state->fps_d, -+ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, -+ state->par_d, NULL); -+ } else if (schro_enc->output_format == GST_SCHRO_ENC_OUTPUT_MPEG_TS) { -+ caps = gst_caps_new_simple ("video/x-mpegts-part", -+ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'), -+ "width", G_TYPE_INT, state->width, -+ "height", G_TYPE_INT, state->height, -+ "framerate", GST_TYPE_FRACTION, state->fps_n, -+ state->fps_d, -+ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, -+ state->par_d, NULL); -+ } else if (schro_enc->output_format == GST_SCHRO_ENC_OUTPUT_MP4) { -+ caps = gst_caps_new_simple ("video/x-mp4-part", -+ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'), -+ "width", G_TYPE_INT, state->width, -+ "height", G_TYPE_INT, state->height, -+ "framerate", GST_TYPE_FRACTION, state->fps_n, -+ state->fps_d, -+ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, -+ state->par_d, NULL); -+ } else { -+ g_assert_not_reached (); -+ } -+ -+ return caps; -+} -+ -+ -+ -+ -+static GstFlowReturn -+gst_schro_enc_shape_output_ogg (GstBaseVideoEncoder * base_video_encoder, -+ GstVideoFrame * frame) -+{ -+ GstSchroEnc *schro_enc; -+ int dpn; -+ int delay; -+ int dist; -+ int pt; -+ int dt; -+ guint64 granulepos_hi; -+ guint64 granulepos_low; -+ GstBuffer *buf = frame->src_buffer; -+ -+ schro_enc = GST_SCHRO_ENC (base_video_encoder); -+ -+ dpn = frame->decode_frame_number; -+ -+ pt = frame->presentation_frame_number * 2 + schro_enc->granule_offset; -+ dt = frame->decode_frame_number * 2 + schro_enc->granule_offset; -+ delay = pt - dt; -+ dist = frame->distance_from_sync; -+ -+ GST_DEBUG ("sys %d dpn %d pt %d dt %d delay %d dist %d", -+ (int) frame->system_frame_number, -+ (int) frame->decode_frame_number, pt, dt, delay, dist); -+ -+ granulepos_hi = (((guint64) pt - delay) << 9) | ((dist >> 8)); -+ granulepos_low = (delay << 9) | (dist & 0xff); -+ GST_DEBUG ("granulepos %" G_GINT64_FORMAT ":%" G_GINT64_FORMAT, granulepos_hi, -+ granulepos_low); -+ -+ if (frame->is_eos) { -+ GST_BUFFER_OFFSET_END (buf) = schro_enc->last_granulepos; -+ } else { -+ schro_enc->last_granulepos = (granulepos_hi << 22) | (granulepos_low); -+ GST_BUFFER_OFFSET_END (buf) = schro_enc->last_granulepos; -+ } -+ -+ gst_buffer_set_caps (buf, base_video_encoder->caps); -+ -+ return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), buf); -+} -+ -+static GstFlowReturn -+gst_schro_enc_shape_output_quicktime (GstBaseVideoEncoder * base_video_encoder, -+ GstVideoFrame * frame) -+{ -+ GstBuffer *buf = frame->src_buffer; -+ const GstVideoState *state; -+ -+ state = gst_base_video_encoder_get_state (base_video_encoder); -+ -+ GST_BUFFER_TIMESTAMP (buf) = gst_video_state_get_timestamp (state, -+ frame->presentation_frame_number); -+ GST_BUFFER_DURATION (buf) = gst_video_state_get_timestamp (state, -+ frame->presentation_frame_number + 1) - GST_BUFFER_TIMESTAMP (buf); -+ GST_BUFFER_OFFSET_END (buf) = gst_video_state_get_timestamp (state, -+ frame->system_frame_number); -+ GST_BUFFER_OFFSET (buf) = GST_CLOCK_TIME_NONE; -+ -+ if (frame->is_sync_point && -+ frame->presentation_frame_number == frame->system_frame_number) { -+ GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DELTA_UNIT); -+ } else { -+ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); -+ } -+ -+ gst_buffer_set_caps (buf, base_video_encoder->caps); -+ -+ return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), buf); -+} -+ -+static GstFlowReturn -+gst_schro_enc_shape_output_mp4 (GstBaseVideoEncoder * base_video_encoder, -+ GstVideoFrame * frame) -+{ -+ GstBuffer *buf = frame->src_buffer; -+ const GstVideoState *state; -+ -+ state = gst_base_video_encoder_get_state (base_video_encoder); -+ -+ GST_BUFFER_TIMESTAMP (buf) = gst_video_state_get_timestamp (state, -+ frame->presentation_frame_number); -+ GST_BUFFER_DURATION (buf) = gst_video_state_get_timestamp (state, -+ frame->presentation_frame_number + 1) - GST_BUFFER_TIMESTAMP (buf); -+ GST_BUFFER_OFFSET_END (buf) = gst_video_state_get_timestamp (state, -+ frame->decode_frame_number); -+ GST_BUFFER_OFFSET (buf) = GST_CLOCK_TIME_NONE; -+ -+ GST_BUFFER_OFFSET_END (buf) = gst_video_state_get_timestamp (state, -+ frame->system_frame_number); -+ -+ if (frame->is_sync_point && -+ frame->presentation_frame_number == frame->system_frame_number) { -+ GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DELTA_UNIT); -+ } else { -+ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); -+ } -+ -+ gst_buffer_set_caps (buf, base_video_encoder->caps); -+ -+ return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), buf); -+} -+ -+static GstFlowReturn -+gst_schro_enc_shape_output (GstBaseVideoEncoder * base_video_encoder, -+ GstVideoFrame * frame) -+{ -+ GstSchroEnc *schro_enc; -+ -+ schro_enc = GST_SCHRO_ENC (base_video_encoder); -+ -+ switch (schro_enc->output_format) { -+ case GST_SCHRO_ENC_OUTPUT_OGG: -+ return gst_schro_enc_shape_output_ogg (base_video_encoder, frame); -+ case GST_SCHRO_ENC_OUTPUT_QUICKTIME: -+ return gst_schro_enc_shape_output_quicktime (base_video_encoder, frame); -+ case GST_SCHRO_ENC_OUTPUT_MP4: -+ return gst_schro_enc_shape_output_mp4 (base_video_encoder, frame); -+ default: -+ g_assert_not_reached (); -+ break; -+ } -+ -+ return GST_FLOW_ERROR; -+} -+ -+static GstFlowReturn -+gst_schro_enc_process (GstSchroEnc * schro_enc) -+{ -+ SchroBuffer *encoded_buffer; -+ GstVideoFrame *frame; -+ GstFlowReturn ret; -+ int presentation_frame; -+ void *voidptr; -+ GstBaseVideoEncoder *base_video_encoder = GST_BASE_VIDEO_ENCODER (schro_enc); -+ -+ GST_DEBUG ("process"); -+ -+ while (1) { -+ switch (schro_encoder_wait (schro_enc->encoder)) { -+ case SCHRO_STATE_NEED_FRAME: -+ return GST_FLOW_OK; -+ case SCHRO_STATE_END_OF_STREAM: -+ GST_DEBUG ("EOS"); -+ return GST_FLOW_OK; -+ case SCHRO_STATE_HAVE_BUFFER: -+ voidptr = NULL; -+ encoded_buffer = schro_encoder_pull_full (schro_enc->encoder, -+ &presentation_frame, &voidptr); -+ frame = voidptr; -+ if (encoded_buffer == NULL) { -+ GST_DEBUG ("encoder_pull returned NULL"); -+ /* FIXME This shouldn't happen */ -+ return GST_FLOW_ERROR; -+ } -+ -+ if (voidptr == NULL) { -+ GST_DEBUG ("got eos"); -+ frame = schro_enc->eos_frame; -+ } -+ -+ if (SCHRO_PARSE_CODE_IS_SEQ_HEADER (encoded_buffer->data[4])) { -+ frame->is_sync_point = TRUE; -+ } -+ -+ frame->src_buffer = gst_schro_wrap_schro_buffer (encoded_buffer); -+ -+ ret = gst_base_video_encoder_finish_frame (base_video_encoder, frame); -+ -+ if (ret != GST_FLOW_OK) { -+ GST_DEBUG ("pad_push returned %d", ret); -+ return ret; -+ } -+ break; -+ case SCHRO_STATE_AGAIN: -+ break; -+ } -+ } -+ return GST_FLOW_OK; -+} -diff -uNr schroedinger-1.0.8.orig/gst/gstschroparse.c schroedinger-1.0.8/gst/gstschroparse.c ---- schroedinger-1.0.8.orig/gst/gstschroparse.c 1970-01-01 01:00:00.000000000 +0100 -+++ schroedinger-1.0.8/gst/gstschroparse.c 2009-10-12 12:23:39.000000000 +0200 -@@ -0,0 +1,610 @@ -+/* Schrodinger -+ * Copyright (C) 2006 David Schleef -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Library General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Library General Public License for more details. -+ * -+ * You should have received a copy of the GNU Library 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. -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+ -+GST_DEBUG_CATEGORY_EXTERN (schro_debug); -+#define GST_CAT_DEFAULT schro_debug -+ -+#define GST_TYPE_SCHRO_PARSE \ -+ (gst_schro_parse_get_type()) -+#define GST_SCHRO_PARSE(obj) \ -+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SCHRO_PARSE,GstSchroParse)) -+#define GST_SCHRO_PARSE_CLASS(klass) \ -+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SCHRO_PARSE,GstSchroParseClass)) -+#define GST_IS_SCHRO_PARSE(obj) \ -+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SCHRO_PARSE)) -+#define GST_IS_SCHRO_PARSE_CLASS(obj) \ -+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SCHRO_PARSE)) -+ -+typedef struct _GstSchroParse GstSchroParse; -+typedef struct _GstSchroParseClass GstSchroParseClass; -+ -+typedef enum -+{ -+ GST_SCHRO_PARSE_OUTPUT_OGG, -+ GST_SCHRO_PARSE_OUTPUT_QUICKTIME, -+ GST_SCHRO_PARSE_OUTPUT_AVI, -+ GST_SCHRO_PARSE_OUTPUT_MPEG_TS, -+ GST_SCHRO_PARSE_OUTPUT_MP4 -+} GstSchroParseOutputType; -+ -+struct _GstSchroParse -+{ -+ GstBaseVideoParse base_video_parse; -+ -+ GstPad *sinkpad, *srcpad; -+ -+ GstSchroParseOutputType output_format; -+ -+ GstBuffer *seq_header_buffer; -+ -+ /* state */ -+ -+ -+ gboolean have_picture; -+ int buf_picture_number; -+ int seq_hdr_picture_number; -+ int picture_number; -+ -+ guint64 last_granulepos; -+ -+ int bytes_per_picture; -+}; -+ -+struct _GstSchroParseClass -+{ -+ GstBaseVideoParseClass base_video_parse_class; -+}; -+ -+/* GstSchroParse signals and args */ -+enum -+{ -+ LAST_SIGNAL -+}; -+ -+enum -+{ -+ ARG_0 -+}; -+ -+static void gst_schro_parse_finalize (GObject * object); -+ -+static gboolean gst_schro_parse_start (GstBaseVideoParse * base_video_parse); -+static gboolean gst_schro_parse_stop (GstBaseVideoParse * base_video_parse); -+static gboolean gst_schro_parse_reset (GstBaseVideoParse * base_video_parse); -+static int gst_schro_parse_scan_for_sync (GstAdapter * adapter, -+ gboolean at_eos, int offset, int n); -+static gboolean gst_schro_parse_parse_data (GstBaseVideoParse * -+ base_video_parse, gboolean at_eos); -+static gboolean gst_schro_parse_shape_output (GstBaseVideoParse * -+ base_video_parse, GstVideoFrame * frame); -+static GstCaps *gst_schro_parse_get_caps (GstBaseVideoParse * base_video_parse); -+ -+ -+ -+static GstStaticPadTemplate gst_schro_parse_sink_template = -+GST_STATIC_PAD_TEMPLATE ("sink", -+ GST_PAD_SINK, -+ GST_PAD_ALWAYS, -+ GST_STATIC_CAPS ("video/x-dirac") -+ ); -+ -+static GstStaticPadTemplate gst_schro_parse_src_template = -+ GST_STATIC_PAD_TEMPLATE ("src", -+ GST_PAD_SRC, -+ GST_PAD_ALWAYS, -+ GST_STATIC_CAPS -+ ("video/x-dirac;video/x-qt-part;video/x-avi-part;video/x-mp4-part") -+ ); -+ -+GST_BOILERPLATE (GstSchroParse, gst_schro_parse, GstBaseVideoParse, -+ GST_TYPE_BASE_VIDEO_PARSE); -+ -+static void -+gst_schro_parse_base_init (gpointer g_class) -+{ -+ static GstElementDetails compress_details = -+ GST_ELEMENT_DETAILS ("Dirac Parser", -+ "Codec/Parser/Video", -+ "Parse Dirac streams", -+ "David Schleef "); -+ GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); -+ -+ gst_element_class_add_pad_template (element_class, -+ gst_static_pad_template_get (&gst_schro_parse_src_template)); -+ gst_element_class_add_pad_template (element_class, -+ gst_static_pad_template_get (&gst_schro_parse_sink_template)); -+ -+ gst_element_class_set_details (element_class, &compress_details); -+} -+ -+static void -+gst_schro_parse_class_init (GstSchroParseClass * klass) -+{ -+ GObjectClass *gobject_class; -+ GstElementClass *element_class; -+ GstBaseVideoParseClass *base_video_parse_class; -+ -+ gobject_class = G_OBJECT_CLASS (klass); -+ element_class = GST_ELEMENT_CLASS (klass); -+ base_video_parse_class = GST_BASE_VIDEO_PARSE_CLASS (klass); -+ -+ gobject_class->finalize = gst_schro_parse_finalize; -+ -+ base_video_parse_class->start = GST_DEBUG_FUNCPTR (gst_schro_parse_start); -+ base_video_parse_class->stop = GST_DEBUG_FUNCPTR (gst_schro_parse_stop); -+ base_video_parse_class->reset = GST_DEBUG_FUNCPTR (gst_schro_parse_reset); -+ base_video_parse_class->parse_data = -+ GST_DEBUG_FUNCPTR (gst_schro_parse_parse_data); -+ base_video_parse_class->shape_output = -+ GST_DEBUG_FUNCPTR (gst_schro_parse_shape_output); -+ base_video_parse_class->scan_for_sync = -+ GST_DEBUG_FUNCPTR (gst_schro_parse_scan_for_sync); -+ base_video_parse_class->get_caps = -+ GST_DEBUG_FUNCPTR (gst_schro_parse_get_caps); -+ -+} -+ -+static void -+gst_schro_parse_init (GstSchroParse * schro_parse, GstSchroParseClass * klass) -+{ -+ GstBaseVideoParse *base_video_parse = GST_BASE_VIDEO_PARSE (schro_parse); -+ -+ GST_DEBUG ("gst_schro_parse_init"); -+ -+ schro_parse->output_format = GST_SCHRO_PARSE_OUTPUT_OGG; -+ -+ base_video_parse->reorder_depth = 2; -+} -+ -+static gboolean -+gst_schro_parse_reset (GstBaseVideoParse * base_video_parse) -+{ -+ GstSchroParse *schro_parse; -+ -+ schro_parse = GST_SCHRO_PARSE (base_video_parse); -+ -+ GST_DEBUG ("reset"); -+ -+ return TRUE; -+} -+ -+static void -+gst_schro_parse_finalize (GObject * object) -+{ -+ GstSchroParse *schro_parse; -+ -+ g_return_if_fail (GST_IS_SCHRO_PARSE (object)); -+ schro_parse = GST_SCHRO_PARSE (object); -+ -+ G_OBJECT_CLASS (parent_class)->finalize (object); -+} -+ -+static gboolean -+gst_schro_parse_start (GstBaseVideoParse * base_video_parse) -+{ -+ GstSchroParse *schro_parse = GST_SCHRO_PARSE (base_video_parse); -+ GstCaps *caps; -+ GstStructure *structure; -+ -+ GST_DEBUG ("start"); -+ caps = -+ gst_pad_get_allowed_caps (GST_BASE_VIDEO_CODEC_SRC_PAD -+ (base_video_parse)); -+ -+ if (gst_caps_is_empty (caps)) { -+ gst_caps_unref (caps); -+ return FALSE; -+ } -+ -+ structure = gst_caps_get_structure (caps, 0); -+ -+ if (gst_structure_has_name (structure, "video/x-dirac")) { -+ schro_parse->output_format = GST_SCHRO_PARSE_OUTPUT_OGG; -+ } else if (gst_structure_has_name (structure, "video/x-qt-part")) { -+ schro_parse->output_format = GST_SCHRO_PARSE_OUTPUT_QUICKTIME; -+ } else if (gst_structure_has_name (structure, "video/x-avi-part")) { -+ schro_parse->output_format = GST_SCHRO_PARSE_OUTPUT_AVI; -+ } else if (gst_structure_has_name (structure, "video/x-mpegts-part")) { -+ schro_parse->output_format = GST_SCHRO_PARSE_OUTPUT_MPEG_TS; -+ } else if (gst_structure_has_name (structure, "video/x-mp4-part")) { -+ schro_parse->output_format = GST_SCHRO_PARSE_OUTPUT_MP4; -+ } else { -+ return FALSE; -+ } -+ -+ gst_caps_unref (caps); -+ return TRUE; -+} -+ -+static gboolean -+gst_schro_parse_stop (GstBaseVideoParse * base_video_parse) -+{ -+ return TRUE; -+} -+ -+static void -+parse_sequence_header (GstSchroParse * schro_parse, guint8 * data, int size) -+{ -+ SchroVideoFormat video_format; -+ int ret; -+ GstVideoState *state; -+ -+ GST_DEBUG ("parse_sequence_header size=%d", size); -+ -+ state = gst_base_video_parse_get_state (GST_BASE_VIDEO_PARSE (schro_parse)); -+ -+ schro_parse->seq_header_buffer = gst_buffer_new_and_alloc (size); -+ memcpy (GST_BUFFER_DATA (schro_parse->seq_header_buffer), data, size); -+ -+ ret = schro_parse_decode_sequence_header (data + 13, size - 13, -+ &video_format); -+ if (ret) { -+ state->fps_n = video_format.frame_rate_numerator; -+ state->fps_d = video_format.frame_rate_denominator; -+ GST_DEBUG ("Frame rate is %d/%d", state->fps_n, state->fps_d); -+ -+ state->width = video_format.width; -+ state->height = video_format.height; -+ GST_DEBUG ("Frame dimensions are %d x %d\n", state->width, state->height); -+ -+ state->clean_width = video_format.clean_width; -+ state->clean_height = video_format.clean_height; -+ state->clean_offset_left = video_format.left_offset; -+ state->clean_offset_top = video_format.top_offset; -+ -+ state->par_n = video_format.aspect_ratio_numerator; -+ state->par_d = video_format.aspect_ratio_denominator; -+ GST_DEBUG ("Pixel aspect ratio is %d/%d", state->par_n, state->par_d); -+ -+ gst_base_video_parse_set_state (GST_BASE_VIDEO_PARSE (schro_parse), state); -+ } else { -+ GST_WARNING ("Failed to get frame rate from sequence header"); -+ } -+ -+} -+ -+static int -+gst_schro_parse_scan_for_sync (GstAdapter * adapter, gboolean at_eos, -+ int offset, int n) -+{ -+ int n_available = gst_adapter_available (adapter) - offset; -+ -+ if (n_available < 4) { -+ if (at_eos) { -+ return n_available; -+ } else { -+ return 0; -+ } -+ } -+ -+ n_available -= 3; -+ -+ return gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x42424344, -+ offset, MIN (n, n_available - 3)); -+} -+ -+static GstFlowReturn -+gst_schro_parse_parse_data (GstBaseVideoParse * base_video_parse, -+ gboolean at_eos) -+{ -+ GstSchroParse *schro_parse; -+ unsigned char header[SCHRO_PARSE_HEADER_SIZE]; -+ int next; -+ int prev; -+ int parse_code; -+ -+ GST_DEBUG ("parse_data"); -+ -+ schro_parse = GST_SCHRO_PARSE (base_video_parse); -+ -+ if (gst_adapter_available (base_video_parse->input_adapter) < -+ SCHRO_PARSE_HEADER_SIZE) { -+ return GST_BASE_VIDEO_PARSE_FLOW_NEED_DATA; -+ } -+ -+ GST_DEBUG ("available %d", -+ gst_adapter_available (base_video_parse->input_adapter)); -+ -+ gst_adapter_copy (base_video_parse->input_adapter, header, 0, -+ SCHRO_PARSE_HEADER_SIZE); -+ -+ parse_code = header[4]; -+ next = GST_READ_UINT32_BE (header + 5); -+ prev = GST_READ_UINT32_BE (header + 9); -+ -+ GST_DEBUG ("%08x %02x %08x %08x", -+ GST_READ_UINT32_BE (header), parse_code, next, prev); -+ -+ if (memcmp (header, "BBCD", 4) != 0 || -+ (next & 0xf0000000) || (prev & 0xf0000000)) { -+ gst_base_video_parse_lost_sync (base_video_parse); -+ return GST_BASE_VIDEO_PARSE_FLOW_NEED_DATA; -+ } -+ -+ if (SCHRO_PARSE_CODE_IS_END_OF_SEQUENCE (parse_code)) { -+ GstVideoFrame *frame; -+ -+ if (next != 0 && next != SCHRO_PARSE_HEADER_SIZE) { -+ GST_WARNING ("next is not 0 or 13 in EOS packet (%d)", next); -+ } -+ -+ gst_base_video_parse_add_to_frame (base_video_parse, -+ SCHRO_PARSE_HEADER_SIZE); -+ -+ frame = gst_base_video_parse_get_frame (base_video_parse); -+ frame->is_eos = TRUE; -+ -+ SCHRO_DEBUG ("eos"); -+ -+ return gst_base_video_parse_finish_frame (base_video_parse); -+ } -+ -+ if (gst_adapter_available (base_video_parse->input_adapter) < next) { -+ return GST_BASE_VIDEO_PARSE_FLOW_NEED_DATA; -+ } -+ -+ if (SCHRO_PARSE_CODE_IS_SEQ_HEADER (parse_code)) { -+ guint8 *data; -+ -+ data = g_malloc (next); -+ -+ gst_adapter_copy (base_video_parse->input_adapter, data, 0, next); -+ parse_sequence_header (schro_parse, data, next); -+ -+ base_video_parse->current_frame->is_sync_point = TRUE; -+ -+ g_free (data); -+ } -+ -+ if (schro_parse->seq_header_buffer == NULL) { -+ gst_adapter_flush (base_video_parse->input_adapter, next); -+ return GST_FLOW_OK; -+ } -+ -+ if (SCHRO_PARSE_CODE_IS_PICTURE (parse_code)) { -+ GstVideoFrame *frame; -+ guint8 tmp[4]; -+ -+ frame = gst_base_video_parse_get_frame (base_video_parse); -+ -+#if 0 -+ if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buf))) { -+ frame->presentation_timestamp = GST_BUFFER_TIMESTAMP (buf); -+ } -+#endif -+ -+ gst_adapter_copy (base_video_parse->input_adapter, tmp, -+ SCHRO_PARSE_HEADER_SIZE, 4); -+ -+ frame->presentation_frame_number = GST_READ_UINT32_BE (tmp); -+ -+ gst_base_video_parse_add_to_frame (base_video_parse, next); -+ -+ return gst_base_video_parse_finish_frame (base_video_parse); -+ } else { -+ gst_base_video_parse_add_to_frame (base_video_parse, next); -+ } -+ -+ return GST_FLOW_OK; -+} -+ -+static GstFlowReturn -+gst_schro_parse_shape_output_ogg (GstBaseVideoParse * base_video_parse, -+ GstVideoFrame * frame) -+{ -+ GstSchroParse *schro_parse; -+ int dpn; -+ int delay; -+ int dist; -+ int pt; -+ int dt; -+ guint64 granulepos_hi; -+ guint64 granulepos_low; -+ GstBuffer *buf = frame->src_buffer; -+ -+ schro_parse = GST_SCHRO_PARSE (base_video_parse); -+ -+ dpn = frame->decode_frame_number; -+ -+ pt = frame->presentation_frame_number * 2; -+ dt = frame->decode_frame_number * 2; -+ delay = pt - dt; -+ dist = frame->distance_from_sync; -+ -+ GST_DEBUG ("sys %d dpn %d pt %d dt %d delay %d dist %d", -+ (int) frame->system_frame_number, -+ (int) frame->decode_frame_number, pt, dt, delay, dist); -+ -+ granulepos_hi = (((guint64) pt - delay) << 9) | ((dist >> 8)); -+ granulepos_low = (delay << 9) | (dist & 0xff); -+ GST_DEBUG ("granulepos %" G_GINT64_FORMAT ":%" G_GINT64_FORMAT, granulepos_hi, -+ granulepos_low); -+ -+ if (frame->is_eos) { -+ GST_BUFFER_OFFSET_END (buf) = schro_parse->last_granulepos; -+ } else { -+ schro_parse->last_granulepos = (granulepos_hi << 22) | (granulepos_low); -+ GST_BUFFER_OFFSET_END (buf) = schro_parse->last_granulepos; -+ } -+ -+ return gst_base_video_parse_push (base_video_parse, buf); -+} -+ -+static GstFlowReturn -+gst_schro_parse_shape_output_quicktime (GstBaseVideoParse * base_video_parse, -+ GstVideoFrame * frame) -+{ -+ GstBuffer *buf = frame->src_buffer; -+ const GstVideoState *state; -+ -+ state = gst_base_video_parse_get_state (base_video_parse); -+ -+ GST_BUFFER_OFFSET_END (buf) = gst_video_state_get_timestamp (state, -+ frame->system_frame_number); -+ -+ if (frame->is_sync_point && -+ frame->presentation_frame_number == frame->system_frame_number) { -+ GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DELTA_UNIT); -+ GST_DEBUG ("sync point"); -+ } else { -+ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); -+ } -+ -+ return gst_base_video_parse_push (base_video_parse, buf); -+} -+ -+static GstFlowReturn -+gst_schro_parse_shape_output_mpeg_ts (GstBaseVideoParse * base_video_parse, -+ GstVideoFrame * frame) -+{ -+ GstBuffer *buf = frame->src_buffer; -+ const GstVideoState *state; -+ -+ state = gst_base_video_parse_get_state (base_video_parse); -+ -+ return gst_base_video_parse_push (base_video_parse, buf); -+} -+ -+static GstFlowReturn -+gst_schro_parse_shape_output (GstBaseVideoParse * base_video_parse, -+ GstVideoFrame * frame) -+{ -+ GstSchroParse *schro_parse; -+ -+ schro_parse = GST_SCHRO_PARSE (base_video_parse); -+ -+ switch (schro_parse->output_format) { -+ case GST_SCHRO_PARSE_OUTPUT_OGG: -+ return gst_schro_parse_shape_output_ogg (base_video_parse, frame); -+ case GST_SCHRO_PARSE_OUTPUT_QUICKTIME: -+ return gst_schro_parse_shape_output_quicktime (base_video_parse, frame); -+ case GST_SCHRO_PARSE_OUTPUT_MPEG_TS: -+ return gst_schro_parse_shape_output_mpeg_ts (base_video_parse, frame); -+ default: -+ break; -+ } -+ -+ return GST_FLOW_ERROR; -+} -+ -+static GstCaps * -+gst_schro_parse_get_caps (GstBaseVideoParse * base_video_parse) -+{ -+ GstCaps *caps; -+ GstVideoState *state; -+ GstSchroParse *schro_parse; -+ -+ schro_parse = GST_SCHRO_PARSE (base_video_parse); -+ -+ state = gst_base_video_parse_get_state (base_video_parse); -+ -+ if (schro_parse->output_format == GST_SCHRO_PARSE_OUTPUT_OGG) { -+ caps = gst_caps_new_simple ("video/x-dirac", -+ "width", G_TYPE_INT, state->width, -+ "height", G_TYPE_INT, state->height, -+ "framerate", GST_TYPE_FRACTION, state->fps_n, -+ state->fps_d, -+ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, -+ state->par_d, NULL); -+ -+ GST_BUFFER_FLAG_SET (schro_parse->seq_header_buffer, -+ GST_BUFFER_FLAG_IN_CAPS); -+ -+ { -+ GValue array = { 0 }; -+ GValue value = { 0 }; -+ GstBuffer *buf; -+ int size; -+ -+ g_value_init (&array, GST_TYPE_ARRAY); -+ g_value_init (&value, GST_TYPE_BUFFER); -+ size = GST_BUFFER_SIZE (schro_parse->seq_header_buffer); -+ buf = gst_buffer_new_and_alloc (size + SCHRO_PARSE_HEADER_SIZE); -+ memcpy (GST_BUFFER_DATA (buf), -+ GST_BUFFER_DATA (schro_parse->seq_header_buffer), size); -+ GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf) + size + 0, 0x42424344); -+ GST_WRITE_UINT8 (GST_BUFFER_DATA (buf) + size + 4, -+ SCHRO_PARSE_CODE_END_OF_SEQUENCE); -+ GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf) + size + 5, 0); -+ GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf) + size + 9, size); -+ gst_value_set_buffer (&value, buf); -+ gst_buffer_unref (buf); -+ gst_value_array_append_value (&array, &value); -+ gst_structure_set_value (gst_caps_get_structure (caps, 0), -+ "streamheader", &array); -+ g_value_unset (&value); -+ g_value_unset (&array); -+ } -+ } else if (schro_parse->output_format == GST_SCHRO_PARSE_OUTPUT_QUICKTIME) { -+ caps = gst_caps_new_simple ("video/x-qt-part", -+ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'), -+ "width", G_TYPE_INT, state->width, -+ "height", G_TYPE_INT, state->height, -+ "framerate", GST_TYPE_FRACTION, state->fps_n, -+ state->fps_d, -+ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, -+ state->par_d, NULL); -+ } else if (schro_parse->output_format == GST_SCHRO_PARSE_OUTPUT_AVI) { -+ caps = gst_caps_new_simple ("video/x-avi-part", -+ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'), -+ "width", G_TYPE_INT, state->width, -+ "height", G_TYPE_INT, state->height, -+ "framerate", GST_TYPE_FRACTION, state->fps_n, -+ state->fps_d, -+ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, -+ state->par_d, NULL); -+ } else if (schro_parse->output_format == GST_SCHRO_PARSE_OUTPUT_MPEG_TS) { -+ caps = gst_caps_new_simple ("video/x-mpegts-part", -+ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'), -+ "width", G_TYPE_INT, state->width, -+ "height", G_TYPE_INT, state->height, -+ "framerate", GST_TYPE_FRACTION, state->fps_n, -+ state->fps_d, -+ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, -+ state->par_d, NULL); -+ } else if (schro_parse->output_format == GST_SCHRO_PARSE_OUTPUT_MP4) { -+ caps = gst_caps_new_simple ("video/x-mp4-part", -+ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'r', 'a', 'c'), -+ "width", G_TYPE_INT, state->width, -+ "height", G_TYPE_INT, state->height, -+ "framerate", GST_TYPE_FRACTION, state->fps_n, -+ state->fps_d, -+ "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, -+ state->par_d, NULL); -+ } else { -+ g_assert_not_reached (); -+ } -+ -+ return caps; -+} -diff -uNr schroedinger-1.0.8.orig/gst/gstschroutils.c schroedinger-1.0.8/gst/gstschroutils.c ---- schroedinger-1.0.8.orig/gst/gstschroutils.c 1970-01-01 01:00:00.000000000 +0100 -+++ schroedinger-1.0.8/gst/gstschroutils.c 2009-09-11 17:35:39.000000000 +0200 -@@ -0,0 +1,149 @@ -+/* Schrodinger -+ * Copyright (C) 2008 David Schleef -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Library General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Library General Public License for more details. -+ * -+ * You should have received a copy of the GNU Library 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. -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+ -+//#define SCHRO_ENABLE_UNSTABLE_API -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+GST_DEBUG_CATEGORY_EXTERN (schro_debug); -+#define GST_CAT_DEFAULT schro_debug -+ -+ -+ -+ -+static void -+gst_schro_frame_free (SchroFrame * frame, void *priv) -+{ -+ gst_buffer_unref (GST_BUFFER (priv)); -+} -+ -+SchroFrame * -+gst_schro_buffer_wrap (GstBuffer * buf, GstVideoFormat format, int width, -+ int height) -+{ -+ SchroFrame *frame; -+ -+ switch (format) { -+ case GST_VIDEO_FORMAT_I420: -+ frame = -+ schro_frame_new_from_data_I420 (GST_BUFFER_DATA (buf), width, height); -+ break; -+ case GST_VIDEO_FORMAT_YV12: -+ frame = -+ schro_frame_new_from_data_YV12 (GST_BUFFER_DATA (buf), width, height); -+ break; -+ case GST_VIDEO_FORMAT_YUY2: -+ frame = -+ schro_frame_new_from_data_YUY2 (GST_BUFFER_DATA (buf), width, height); -+ break; -+ case GST_VIDEO_FORMAT_UYVY: -+ frame = -+ schro_frame_new_from_data_UYVY (GST_BUFFER_DATA (buf), width, height); -+ break; -+ case GST_VIDEO_FORMAT_AYUV: -+ frame = -+ schro_frame_new_from_data_AYUV (GST_BUFFER_DATA (buf), width, height); -+ break; -+#if 0 -+ case GST_VIDEO_FORMAT_ARGB: -+ { -+ SchroFrame *rgbframe = -+ schro_frame_new_from_data_AYUV (GST_BUFFER_DATA (buf), width, height); -+ SchroFrame *vframe1; -+ SchroFrame *vframe2; -+ SchroFrame *vframe3; -+ -+ vframe1 = schro_virt_frame_new_unpack (rgbframe); -+ vframe2 = schro_virt_frame_new_color_matrix (vframe1); -+ vframe3 = -+ schro_virt_frame_new_subsample (vframe2, SCHRO_FRAME_FORMAT_U8_420); -+ -+ frame = schro_frame_new_and_alloc (NULL, SCHRO_FRAME_FORMAT_U8_420, -+ width, height); -+ schro_virt_frame_render (vframe3, frame); -+ schro_frame_unref (vframe3); -+ } -+ break; -+#endif -+ default: -+ g_assert_not_reached (); -+ } -+ schro_frame_set_free_callback (frame, gst_schro_frame_free, buf); -+ -+ return frame; -+} -+ -+#ifdef GST_BUFFER_FREE_FUNC -+static void -+schro_buf_free_func (gpointer priv) -+{ -+ SchroBuffer *buffer = (SchroBuffer *) priv; -+ -+ schro_buffer_unref (buffer); -+} -+#endif -+ -+/* takes the reference */ -+GstBuffer * -+gst_schro_wrap_schro_buffer (SchroBuffer * buffer) -+{ -+ GstBuffer *gstbuf; -+ -+#ifdef GST_BUFFER_FREE_FUNC -+ gstbuf = gst_buffer_new (); -+ GST_BUFFER_DATA (gstbuf) = buffer->data; -+ GST_BUFFER_SIZE (gstbuf) = buffer->length; -+ GST_BUFFER_MALLOCDATA (gstbuf) = (void *) buffer; -+ GST_BUFFER_FREE_FUNC (gstbuf) = schro_buf_free_func; -+#else -+ gstbuf = gst_buffer_new_and_alloc (buffer->length); -+ memcpy (GST_BUFFER_DATA (gstbuf), buffer->data, buffer->length); -+#endif -+ -+ return gstbuf; -+} -+ -+static void -+gst_schro_buffer_free (SchroBuffer * buffer, void *priv) -+{ -+ gst_buffer_unref (GST_BUFFER (priv)); -+} -+ -+SchroBuffer * -+gst_schro_wrap_gst_buffer (GstBuffer * buffer) -+{ -+ SchroBuffer *schrobuf; -+ -+ schrobuf = schro_buffer_new_with_data (GST_BUFFER_DATA (buffer), -+ GST_BUFFER_SIZE (buffer)); -+ schrobuf->free = gst_schro_buffer_free; -+ schrobuf->priv = buffer; -+ -+ return schrobuf; -+} -diff -uNr schroedinger-1.0.8.orig/gst/gstschroutils.h schroedinger-1.0.8/gst/gstschroutils.h ---- schroedinger-1.0.8.orig/gst/gstschroutils.h 1970-01-01 01:00:00.000000000 +0100 -+++ schroedinger-1.0.8/gst/gstschroutils.h 2009-09-11 17:35:39.000000000 +0200 -@@ -0,0 +1,34 @@ -+/* Schrodinger -+ * Copyright (C) 2008 David Schleef -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Library General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Library General Public License for more details. -+ * -+ * You should have received a copy of the GNU Library 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. -+ */ -+ -+#ifndef _GST_SCHRO_UTILS_H_ -+#define _GST_SCHRO_UTILS_H_ -+ -+#include -+#include -+#include -+ -+SchroFrame * -+gst_schro_buffer_wrap (GstBuffer *buf, GstVideoFormat format, int width, -+ int height); -+GstBuffer * gst_schro_wrap_schro_buffer (SchroBuffer *buffer); -+SchroBuffer * gst_schro_wrap_gst_buffer (GstBuffer *buffer); -+ -+#endif -+ -diff -uNr schroedinger-1.0.8.orig/gst/Makefile.am schroedinger-1.0.8/gst/Makefile.am ---- schroedinger-1.0.8.orig/gst/Makefile.am 1970-01-01 01:00:00.000000000 +0100 -+++ schroedinger-1.0.8/gst/Makefile.am 2009-10-12 12:23:39.000000000 +0200 -@@ -0,0 +1,27 @@ -+ -+plugin_LTLIBRARIES = libgstschro.la -+ -+noinst_HEADERS = \ -+ gstschroutils.h -+ -+libgstschro_la_SOURCES = \ -+ gstschro.c \ -+ gstschrodec.c \ -+ gstschroenc.c \ -+ gstschroparse.c \ -+ gstschroutils.c -+libgstschro_la_CFLAGS = \ -+ $(GST_CFLAGS) \ -+ $(GST_PLUGINS_BASE_CFLAGS) \ -+ $(GST_BASE_CFLAGS) \ -+ -DGST_USE_UNSTABLE_API \ -+ $(SCHRO_CFLAGS) -I$(top_srcdir)/gst-libs -+libgstschro_la_LIBADD = \ -+ $(top_builddir)/gst-libs/gst/video/libgstbasevideo-@GST_MAJORMINOR@.la \ -+ $(GST_PLUGINS_BASE_LIBS) -lgstvideo-@GST_MAJORMINOR@ \ -+ $(GST_BASE_LIBS) $(GST_LIBS) \ -+ $(SCHRO_LIBS) -+libgstschro_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -+libgstschro_la_LIBTOOLFLAGS = --tag=disable-static -+ -+ -diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideocodec.c schroedinger-1.0.8/gst-libs/gst/video/gstbasevideocodec.c ---- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideocodec.c 1970-01-01 01:00:00.000000000 +0100 -+++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideocodec.c 2009-09-11 17:35:39.000000000 +0200 -@@ -0,0 +1,565 @@ -+/* Schrodinger -+ * Copyright (C) 2006 David Schleef -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Library General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Library General Public License for more details. -+ * -+ * You should have received a copy of the GNU Library 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. -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+ -+#include "gstbasevideocodec.h" -+ -+#include -+#include -+ -+GST_DEBUG_CATEGORY (basevideo_debug); -+#define GST_CAT_DEFAULT basevideo_debug -+ -+/* GstBaseVideoCodec signals and args */ -+enum -+{ -+ LAST_SIGNAL -+}; -+ -+enum -+{ -+ ARG_0 -+}; -+ -+static void gst_base_video_codec_finalize (GObject * object); -+ -+static GstStateChangeReturn gst_base_video_codec_change_state (GstElement * -+ element, GstStateChange transition); -+ -+ -+GST_BOILERPLATE (GstBaseVideoCodec, gst_base_video_codec, GstElement, -+ GST_TYPE_ELEMENT); -+ -+static void -+gst_base_video_codec_base_init (gpointer g_class) -+{ -+ GST_DEBUG_CATEGORY_INIT (basevideo_debug, "basevideo", 0, -+ "Base Video Classes"); -+ -+} -+ -+static void -+gst_base_video_codec_class_init (GstBaseVideoCodecClass * klass) -+{ -+ GObjectClass *gobject_class; -+ GstElementClass *element_class; -+ -+ gobject_class = G_OBJECT_CLASS (klass); -+ element_class = GST_ELEMENT_CLASS (klass); -+ -+ gobject_class->finalize = gst_base_video_codec_finalize; -+ -+ element_class->change_state = gst_base_video_codec_change_state; -+} -+ -+static void -+gst_base_video_codec_init (GstBaseVideoCodec * base_video_codec, -+ GstBaseVideoCodecClass * klass) -+{ -+ GstPadTemplate *pad_template; -+ -+ GST_DEBUG ("gst_base_video_codec_init"); -+ -+ pad_template = -+ gst_element_class_get_pad_template (GST_ELEMENT_CLASS (klass), "sink"); -+ g_return_if_fail (pad_template != NULL); -+ -+ base_video_codec->sinkpad = gst_pad_new_from_template (pad_template, "sink"); -+ gst_element_add_pad (GST_ELEMENT (base_video_codec), -+ base_video_codec->sinkpad); -+ -+ pad_template = -+ gst_element_class_get_pad_template (GST_ELEMENT_CLASS (klass), "src"); -+ g_return_if_fail (pad_template != NULL); -+ -+ base_video_codec->srcpad = gst_pad_new_from_template (pad_template, "src"); -+ gst_pad_use_fixed_caps (base_video_codec->srcpad); -+ gst_element_add_pad (GST_ELEMENT (base_video_codec), -+ base_video_codec->srcpad); -+ -+ base_video_codec->input_adapter = gst_adapter_new (); -+ base_video_codec->output_adapter = gst_adapter_new (); -+ -+} -+ -+static void -+gst_base_video_codec_reset (GstBaseVideoCodec * base_video_codec) -+{ -+ GST_DEBUG ("reset"); -+ -+ base_video_codec->system_frame_number = 0; -+ -+ gst_adapter_clear (base_video_codec->input_adapter); -+ gst_adapter_clear (base_video_codec->output_adapter); -+ -+} -+ -+static void -+gst_base_video_codec_finalize (GObject * object) -+{ -+ GstBaseVideoCodec *base_video_codec; -+ -+ g_return_if_fail (GST_IS_BASE_VIDEO_CODEC (object)); -+ base_video_codec = GST_BASE_VIDEO_CODEC (object); -+ -+ if (base_video_codec->input_adapter) { -+ g_object_unref (base_video_codec->input_adapter); -+ } -+ if (base_video_codec->output_adapter) { -+ g_object_unref (base_video_codec->output_adapter); -+ } -+ -+ G_OBJECT_CLASS (parent_class)->finalize (object); -+} -+ -+#ifdef unused -+static const GstQueryType * -+gst_base_video_codec_get_query_types (GstPad * pad) -+{ -+ static const GstQueryType query_types[] = { -+ GST_QUERY_POSITION, -+ GST_QUERY_DURATION, -+ GST_QUERY_CONVERT, -+ 0 -+ }; -+ -+ return query_types; -+} -+#endif -+ -+#if 0 -+static gboolean -+gst_base_video_codec_src_convert (GstPad * pad, -+ GstFormat src_format, gint64 src_value, -+ GstFormat * dest_format, gint64 * dest_value) -+{ -+ gboolean res; -+ GstBaseVideoCodec *dec; -+ -+ if (src_format == *dest_format) { -+ *dest_value = src_value; -+ return TRUE; -+ } -+ -+ dec = GST_BASE_VIDEO_CODEC (gst_pad_get_parent (pad)); -+ -+ if (src_format == GST_FORMAT_DEFAULT && *dest_format == GST_FORMAT_TIME) { -+ if (dec->fps_d != 0) { -+ *dest_value = gst_util_uint64_scale (granulepos_to_frame (src_value), -+ dec->fps_d * GST_SECOND, dec->fps_n); -+ res = TRUE; -+ } else { -+ res = FALSE; -+ } -+ } else { -+ GST_WARNING ("unhandled conversion from %d to %d", src_format, -+ *dest_format); -+ res = FALSE; -+ } -+ -+ gst_object_unref (dec); -+ -+ return res; -+} -+ -+static gboolean -+gst_base_video_codec_sink_convert (GstPad * pad, -+ GstFormat src_format, gint64 src_value, -+ GstFormat * dest_format, gint64 * dest_value) -+{ -+ gboolean res = TRUE; -+ GstBaseVideoCodec *dec; -+ -+ if (src_format == *dest_format) { -+ *dest_value = src_value; -+ return TRUE; -+ } -+ -+ dec = GST_BASE_VIDEO_CODEC (gst_pad_get_parent (pad)); -+ -+ /* FIXME: check if we are in a decoding state */ -+ -+ switch (src_format) { -+ case GST_FORMAT_DEFAULT: -+ switch (*dest_format) { -+ case GST_FORMAT_TIME: -+ *dest_value = gst_util_uint64_scale (src_value, -+ dec->fps_d * GST_SECOND, dec->fps_n); -+ break; -+ default: -+ res = FALSE; -+ } -+ break; -+ case GST_FORMAT_TIME: -+ switch (*dest_format) { -+ case GST_FORMAT_DEFAULT: -+ { -+ *dest_value = gst_util_uint64_scale (src_value, -+ dec->fps_n, dec->fps_d * GST_SECOND); -+ break; -+ } -+ default: -+ res = FALSE; -+ break; -+ } -+ break; -+ default: -+ res = FALSE; -+ break; -+ } -+ -+ gst_object_unref (dec); -+ -+ return res; -+} -+#endif -+ -+#ifdef unused -+static gboolean -+gst_base_video_codec_src_query (GstPad * pad, GstQuery * query) -+{ -+ GstBaseVideoCodec *base_codec; -+ gboolean res = FALSE; -+ -+ base_codec = GST_BASE_VIDEO_CODEC (gst_pad_get_parent (pad)); -+ -+ switch (GST_QUERY_TYPE (query)) { -+ case GST_QUERY_POSITION: -+ { -+ GstFormat format; -+ gint64 time; -+ gint64 value; -+ -+ gst_query_parse_position (query, &format, NULL); -+ -+ time = gst_util_uint64_scale (base_codec->system_frame_number, -+ base_codec->state.fps_n, base_codec->state.fps_d); -+ time += base_codec->state.segment.time; -+ GST_DEBUG ("query position %lld", time); -+ res = gst_base_video_encoded_video_convert (&base_codec->state, -+ GST_FORMAT_TIME, time, &format, &value); -+ if (!res) -+ goto error; -+ -+ gst_query_set_position (query, format, value); -+ break; -+ } -+ case GST_QUERY_DURATION: -+ res = gst_pad_query (GST_PAD_PEER (base_codec->sinkpad), query); -+ if (!res) -+ goto error; -+ break; -+ case GST_QUERY_CONVERT: -+ { -+ GstFormat src_fmt, dest_fmt; -+ gint64 src_val, dest_val; -+ -+ GST_DEBUG ("query convert"); -+ -+ gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); -+ res = gst_base_video_encoded_video_convert (&base_codec->state, -+ src_fmt, src_val, &dest_fmt, &dest_val); -+ if (!res) -+ goto error; -+ gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); -+ break; -+ } -+ default: -+ res = gst_pad_query_default (pad, query); -+ break; -+ } -+done: -+ gst_object_unref (base_codec); -+ -+ return res; -+error: -+ GST_DEBUG_OBJECT (base_codec, "query failed"); -+ goto done; -+} -+#endif -+ -+#ifdef unused -+static gboolean -+gst_base_video_codec_sink_query (GstPad * pad, GstQuery * query) -+{ -+ GstBaseVideoCodec *base_video_codec; -+ gboolean res = FALSE; -+ -+ base_video_codec = GST_BASE_VIDEO_CODEC (gst_pad_get_parent (pad)); -+ -+ switch (GST_QUERY_TYPE (query)) { -+ case GST_QUERY_CONVERT: -+ { -+ GstFormat src_fmt, dest_fmt; -+ gint64 src_val, dest_val; -+ -+ gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); -+ res = gst_base_video_encoded_video_convert (&base_video_codec->state, -+ src_fmt, src_val, &dest_fmt, &dest_val); -+ if (!res) -+ goto error; -+ gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); -+ break; -+ } -+ default: -+ res = gst_pad_query_default (pad, query); -+ break; -+ } -+done: -+ gst_object_unref (base_video_codec); -+ -+ return res; -+error: -+ GST_DEBUG_OBJECT (base_video_codec, "query failed"); -+ goto done; -+} -+#endif -+ -+#ifdef unused -+static gboolean -+gst_base_video_codec_src_event (GstPad * pad, GstEvent * event) -+{ -+ GstBaseVideoCodec *base_video_codec; -+ gboolean res = FALSE; -+ -+ base_video_codec = GST_BASE_VIDEO_CODEC (gst_pad_get_parent (pad)); -+ -+ switch (GST_EVENT_TYPE (event)) { -+ case GST_EVENT_SEEK: -+ { -+ GstFormat format, tformat; -+ gdouble rate; -+ GstEvent *real_seek; -+ GstSeekFlags flags; -+ GstSeekType cur_type, stop_type; -+ gint64 cur, stop; -+ gint64 tcur, tstop; -+ -+ gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, -+ &cur, &stop_type, &stop); -+ gst_event_unref (event); -+ -+ tformat = GST_FORMAT_TIME; -+ res = gst_base_video_encoded_video_convert (&base_video_codec->state, -+ format, cur, &tformat, &tcur); -+ if (!res) -+ goto convert_error; -+ res = gst_base_video_encoded_video_convert (&base_video_codec->state, -+ format, stop, &tformat, &tstop); -+ if (!res) -+ goto convert_error; -+ -+ real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME, -+ flags, cur_type, tcur, stop_type, tstop); -+ -+ res = gst_pad_push_event (base_video_codec->sinkpad, real_seek); -+ -+ break; -+ } -+#if 0 -+ case GST_EVENT_QOS: -+ { -+ gdouble proportion; -+ GstClockTimeDiff diff; -+ GstClockTime timestamp; -+ -+ gst_event_parse_qos (event, &proportion, &diff, ×tamp); -+ -+ GST_OBJECT_LOCK (base_video_codec); -+ base_video_codec->proportion = proportion; -+ base_video_codec->earliest_time = timestamp + diff; -+ GST_OBJECT_UNLOCK (base_video_codec); -+ -+ GST_DEBUG_OBJECT (base_video_codec, -+ "got QoS %" GST_TIME_FORMAT ", %" G_GINT64_FORMAT, -+ GST_TIME_ARGS (timestamp), diff); -+ -+ res = gst_pad_push_event (base_video_codec->sinkpad, event); -+ break; -+ } -+#endif -+ default: -+ res = gst_pad_push_event (base_video_codec->sinkpad, event); -+ break; -+ } -+done: -+ gst_object_unref (base_video_codec); -+ return res; -+ -+convert_error: -+ GST_DEBUG_OBJECT (base_video_codec, "could not convert format"); -+ goto done; -+} -+#endif -+ -+#ifdef unused -+static gboolean -+gst_base_video_codec_sink_event (GstPad * pad, GstEvent * event) -+{ -+ GstBaseVideoCodec *base_video_codec; -+ gboolean ret = FALSE; -+ -+ base_video_codec = GST_BASE_VIDEO_CODEC (gst_pad_get_parent (pad)); -+ -+ switch (GST_EVENT_TYPE (event)) { -+ case GST_EVENT_FLUSH_START: -+ ret = gst_pad_push_event (base_video_codec->srcpad, event); -+ break; -+ case GST_EVENT_FLUSH_STOP: -+ gst_base_video_codec_reset (base_video_codec); -+ ret = gst_pad_push_event (base_video_codec->srcpad, event); -+ break; -+ case GST_EVENT_EOS: -+ if (gst_base_video_codec_push_all (base_video_codec, -+ FALSE) == GST_FLOW_ERROR) { -+ gst_event_unref (event); -+ return FALSE; -+ } -+ -+ ret = gst_pad_push_event (base_video_codec->srcpad, event); -+ break; -+ case GST_EVENT_NEWSEGMENT: -+ { -+ gboolean update; -+ GstFormat format; -+ gdouble rate; -+ gint64 start, stop, time; -+ -+ gst_event_parse_new_segment (event, &update, &rate, &format, &start, -+ &stop, &time); -+ -+ if (format != GST_FORMAT_TIME) -+ goto newseg_wrong_format; -+ -+ if (rate <= 0.0) -+ goto newseg_wrong_rate; -+ -+ GST_DEBUG ("newsegment %lld %lld", start, time); -+ gst_segment_set_newsegment (&base_video_codec->state.segment, update, -+ rate, format, start, stop, time); -+ -+ ret = gst_pad_push_event (base_video_codec->srcpad, event); -+ break; -+ } -+ default: -+ ret = gst_pad_push_event (base_video_codec->srcpad, event); -+ break; -+ } -+done: -+ gst_object_unref (base_video_codec); -+ return ret; -+ -+newseg_wrong_format: -+ GST_DEBUG_OBJECT (base_video_codec, "received non TIME newsegment"); -+ gst_event_unref (event); -+ goto done; -+ -+newseg_wrong_rate: -+ GST_DEBUG_OBJECT (base_video_codec, "negative rates not supported"); -+ gst_event_unref (event); -+ goto done; -+} -+#endif -+ -+ -+static GstStateChangeReturn -+gst_base_video_codec_change_state (GstElement * element, -+ GstStateChange transition) -+{ -+ GstBaseVideoCodec *base_video_codec = GST_BASE_VIDEO_CODEC (element); -+ GstStateChangeReturn ret; -+ -+ switch (transition) { -+ case GST_STATE_CHANGE_NULL_TO_READY: -+ break; -+ case GST_STATE_CHANGE_READY_TO_PAUSED: -+ gst_base_video_codec_reset (base_video_codec); -+ break; -+ case GST_STATE_CHANGE_PAUSED_TO_PLAYING: -+ break; -+ default: -+ break; -+ } -+ -+ ret = parent_class->change_state (element, transition); -+ -+ switch (transition) { -+ case GST_STATE_CHANGE_PLAYING_TO_PAUSED: -+ break; -+ case GST_STATE_CHANGE_PAUSED_TO_READY: -+ gst_base_video_codec_reset (base_video_codec); -+ break; -+ case GST_STATE_CHANGE_READY_TO_NULL: -+ break; -+ default: -+ break; -+ } -+ -+ return ret; -+} -+ -+#if 0 -+guint64 -+gst_base_video_codec_get_timestamp (GstBaseVideoCodec * base_video_codec, -+ int picture_number) -+{ -+ if (picture_number < 0) { -+ return base_video_codec->timestamp_offset - -+ (gint64) gst_util_uint64_scale (-picture_number, -+ base_video_codec->state.fps_d * GST_SECOND, -+ base_video_codec->state.fps_n); -+ } else { -+ return base_video_codec->timestamp_offset + -+ gst_util_uint64_scale (picture_number, -+ base_video_codec->state.fps_d * GST_SECOND, -+ base_video_codec->state.fps_n); -+ } -+} -+#endif -+ -+GstVideoFrame * -+gst_base_video_codec_new_frame (GstBaseVideoCodec * base_video_codec) -+{ -+ GstVideoFrame *frame; -+ -+ frame = g_malloc0 (sizeof (GstVideoFrame)); -+ -+ frame->system_frame_number = base_video_codec->system_frame_number; -+ base_video_codec->system_frame_number++; -+ -+ return frame; -+} -+ -+void -+gst_base_video_codec_free_frame (GstVideoFrame * frame) -+{ -+ if (frame->sink_buffer) { -+ gst_buffer_unref (frame->sink_buffer); -+ } -+#if 0 -+ if (frame->src_buffer) { -+ gst_buffer_unref (frame->src_buffer); -+ } -+#endif -+ -+ g_free (frame); -+} -diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideocodec.h schroedinger-1.0.8/gst-libs/gst/video/gstbasevideocodec.h ---- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideocodec.h 1970-01-01 01:00:00.000000000 +0100 -+++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideocodec.h 2009-09-11 17:35:39.000000000 +0200 -@@ -0,0 +1,150 @@ -+/* GStreamer -+ * Copyright (C) 2008 David Schleef -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Library General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Library General Public License for more details. -+ * -+ * You should have received a copy of the GNU Library 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. -+ */ -+ -+#ifndef _GST_BASE_VIDEO_CODEC_H_ -+#define _GST_BASE_VIDEO_CODEC_H_ -+ -+#ifndef GST_USE_UNSTABLE_API -+#warning "GstBaseVideoCodec is unstable API and may change in future." -+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning." -+#endif -+ -+#include -+#include -+ -+G_BEGIN_DECLS -+ -+#define GST_TYPE_BASE_VIDEO_CODEC \ -+ (gst_base_video_codec_get_type()) -+#define GST_BASE_VIDEO_CODEC(obj) \ -+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_VIDEO_CODEC,GstBaseVideoCodec)) -+#define GST_BASE_VIDEO_CODEC_CLASS(klass) \ -+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_VIDEO_CODEC,GstBaseVideoCodecClass)) -+#define GST_BASE_VIDEO_CODEC_GET_CLASS(obj) \ -+ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_VIDEO_CODEC,GstBaseVideoCodecClass)) -+#define GST_IS_BASE_VIDEO_CODEC(obj) \ -+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_VIDEO_CODEC)) -+#define GST_IS_BASE_VIDEO_CODEC_CLASS(obj) \ -+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_VIDEO_CODEC)) -+ -+/** -+ * GST_BASE_VIDEO_CODEC_SINK_NAME: -+ * -+ * The name of the templates for the sink pad. -+ */ -+#define GST_BASE_VIDEO_CODEC_SINK_NAME "sink" -+/** -+ * GST_BASE_VIDEO_CODEC_SRC_NAME: -+ * -+ * The name of the templates for the source pad. -+ */ -+#define GST_BASE_VIDEO_CODEC_SRC_NAME "src" -+ -+/** -+ * GST_BASE_VIDEO_CODEC_SRC_PAD: -+ * @obj: base video codec instance -+ * -+ * Gives the pointer to the source #GstPad object of the element. -+ */ -+#define GST_BASE_VIDEO_CODEC_SRC_PAD(obj) (((GstBaseVideoCodec *) (obj))->srcpad) -+ -+/** -+ * GST_BASE_VIDEO_CODEC_SINK_PAD: -+ * @obj: base video codec instance -+ * -+ * Gives the pointer to the sink #GstPad object of the element. -+ */ -+#define GST_BASE_VIDEO_CODEC_SINK_PAD(obj) (((GstBaseVideoCodec *) (obj))->sinkpad) -+ -+/** -+ * GST_BASE_VIDEO_CODEC_FLOW_NEED_DATA: -+ * -+ */ -+#define GST_BASE_VIDEO_CODEC_FLOW_NEED_DATA GST_FLOW_CUSTOM_SUCCESS -+ -+typedef struct _GstBaseVideoCodec GstBaseVideoCodec; -+typedef struct _GstBaseVideoCodecClass GstBaseVideoCodecClass; -+ -+struct _GstBaseVideoCodec -+{ -+ GstElement element; -+ -+ /*< private >*/ -+ GstPad *sinkpad; -+ GstPad *srcpad; -+ GstAdapter *input_adapter; -+ GstAdapter *output_adapter; -+ -+#if 0 -+ /* FIXME need to move from subclasses */ -+ GstVideoState state; -+#endif -+ -+ //int reorder_depth; -+ -+ //gboolean have_sync; -+ //gboolean discont; -+ //gboolean started; -+ -+ //GstVideoFrame *current_frame; -+ //int distance_from_sync; -+ -+ //gboolean sink_clipping; -+ -+ //guint64 presentation_frame_number; -+ guint64 system_frame_number; -+ -+ //GstCaps *caps; -+ //gboolean set_output_caps; -+ -+ //GstClockTime buffer_timestamp; -+ -+ GstClockTime timestamp_offset; -+}; -+ -+struct _GstBaseVideoCodecClass -+{ -+ GstElementClass element_class; -+ -+ gboolean (*start) (GstBaseVideoCodec *codec); -+ gboolean (*stop) (GstBaseVideoCodec *codec); -+ gboolean (*reset) (GstBaseVideoCodec *codec); -+ GstFlowReturn (*parse_data) (GstBaseVideoCodec *codec, gboolean at_eos); -+ int (*scan_for_sync) (GstAdapter *adapter, gboolean at_eos, -+ int offset, int n); -+ GstFlowReturn (*shape_output) (GstBaseVideoCodec *codec, GstVideoFrame *frame); -+ GstCaps *(*get_caps) (GstBaseVideoCodec *codec); -+ -+}; -+ -+GType gst_base_video_codec_get_type (void); -+ -+#if 0 -+guint64 gst_base_video_codec_get_timestamp (GstBaseVideoCodec *codec, -+ int picture_number); -+#endif -+ -+GstVideoFrame * gst_base_video_codec_new_frame (GstBaseVideoCodec *base_video_codec); -+void gst_base_video_codec_free_frame (GstVideoFrame *frame); -+ -+ -+G_END_DECLS -+ -+#endif -+ -diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideodecoder.c schroedinger-1.0.8/gst-libs/gst/video/gstbasevideodecoder.c ---- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideodecoder.c 1970-01-01 01:00:00.000000000 +0100 -+++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideodecoder.c 2009-10-12 12:23:39.000000000 +0200 -@@ -0,0 +1,1223 @@ -+/* GStreamer -+ * Copyright (C) 2008 David Schleef -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Library General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Library General Public License for more details. -+ * -+ * You should have received a copy of the GNU Library 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. -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+ -+#include "gstbasevideodecoder.h" -+ -+#include -+ -+GST_DEBUG_CATEGORY_EXTERN (basevideo_debug); -+#define GST_CAT_DEFAULT basevideo_debug -+ -+static void gst_base_video_decoder_finalize (GObject * object); -+ -+static gboolean gst_base_video_decoder_sink_activate_push (GstPad * pad, -+ gboolean active); -+static gboolean gst_base_video_decoder_sink_setcaps (GstPad * pad, -+ GstCaps * caps); -+static gboolean gst_base_video_decoder_sink_event (GstPad * pad, -+ GstEvent * event); -+static gboolean gst_base_video_decoder_src_event (GstPad * pad, -+ GstEvent * event); -+static GstFlowReturn gst_base_video_decoder_chain (GstPad * pad, -+ GstBuffer * buf); -+static gboolean gst_base_video_decoder_sink_query (GstPad * pad, -+ GstQuery * query); -+static GstStateChangeReturn gst_base_video_decoder_change_state (GstElement * -+ element, GstStateChange transition); -+static const GstQueryType *gst_base_video_decoder_get_query_types (GstPad * -+ pad); -+static gboolean gst_base_video_decoder_src_query (GstPad * pad, -+ GstQuery * query); -+static gboolean gst_base_video_decoder_src_convert (GstPad * pad, -+ GstFormat src_format, gint64 src_value, GstFormat * dest_format, -+ gint64 * dest_value); -+static void gst_base_video_decoder_reset (GstBaseVideoDecoder * -+ base_video_decoder); -+ -+static guint64 -+gst_base_video_decoder_get_timestamp (GstBaseVideoDecoder * base_video_decoder, -+ int picture_number); -+static guint64 -+gst_base_video_decoder_get_field_timestamp (GstBaseVideoDecoder * -+ base_video_decoder, int field_offset); -+static GstVideoFrame *gst_base_video_decoder_new_frame (GstBaseVideoDecoder * -+ base_video_decoder); -+static void gst_base_video_decoder_free_frame (GstVideoFrame * frame); -+ -+GST_BOILERPLATE (GstBaseVideoDecoder, gst_base_video_decoder, -+ GstBaseVideoCodec, GST_TYPE_BASE_VIDEO_CODEC); -+ -+static void -+gst_base_video_decoder_base_init (gpointer g_class) -+{ -+ -+} -+ -+static void -+gst_base_video_decoder_class_init (GstBaseVideoDecoderClass * klass) -+{ -+ GObjectClass *gobject_class; -+ GstElementClass *gstelement_class; -+ -+ gobject_class = G_OBJECT_CLASS (klass); -+ gstelement_class = GST_ELEMENT_CLASS (klass); -+ -+ gobject_class->finalize = gst_base_video_decoder_finalize; -+ -+ gstelement_class->change_state = gst_base_video_decoder_change_state; -+ -+ parent_class = g_type_class_peek_parent (klass); -+} -+ -+static void -+gst_base_video_decoder_init (GstBaseVideoDecoder * base_video_decoder, -+ GstBaseVideoDecoderClass * klass) -+{ -+ GstPad *pad; -+ -+ GST_DEBUG ("gst_base_video_decoder_init"); -+ -+ pad = GST_BASE_VIDEO_CODEC_SINK_PAD (base_video_decoder); -+ -+ gst_pad_set_activatepush_function (pad, -+ gst_base_video_decoder_sink_activate_push); -+ gst_pad_set_chain_function (pad, gst_base_video_decoder_chain); -+ gst_pad_set_event_function (pad, gst_base_video_decoder_sink_event); -+ gst_pad_set_setcaps_function (pad, gst_base_video_decoder_sink_setcaps); -+ gst_pad_set_query_function (pad, gst_base_video_decoder_sink_query); -+ -+ pad = GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder); -+ -+ gst_pad_set_event_function (pad, gst_base_video_decoder_src_event); -+ gst_pad_set_query_type_function (pad, gst_base_video_decoder_get_query_types); -+ gst_pad_set_query_function (pad, gst_base_video_decoder_src_query); -+ -+ base_video_decoder->input_adapter = gst_adapter_new (); -+ base_video_decoder->output_adapter = gst_adapter_new (); -+ -+ gst_segment_init (&base_video_decoder->state.segment, GST_FORMAT_TIME); -+ gst_base_video_decoder_reset (base_video_decoder); -+ -+ base_video_decoder->current_frame = -+ gst_base_video_decoder_new_frame (base_video_decoder); -+ -+ base_video_decoder->sink_clipping = TRUE; -+} -+ -+static gboolean -+gst_base_video_decoder_sink_activate (GstBaseVideoDecoder * decoder, -+ gboolean active) -+{ -+ GstBaseVideoDecoderClass *klass; -+ gboolean result = FALSE; -+ -+ GST_DEBUG_OBJECT (decoder, "activate"); -+ -+ klass = GST_BASE_VIDEO_DECODER_GET_CLASS (decoder); -+ -+ if (active) { -+ if (klass->start) -+ result = klass->start (decoder); -+ } else { -+ /* We must make sure streaming has finished before resetting things -+ * and calling the ::stop vfunc */ -+ GST_PAD_STREAM_LOCK (GST_BASE_VIDEO_CODEC_SINK_PAD (decoder)); -+ GST_PAD_STREAM_UNLOCK (GST_BASE_VIDEO_CODEC_SINK_PAD (decoder)); -+ -+ if (klass->stop) -+ result = klass->stop (decoder); -+ } -+ -+ GST_DEBUG_OBJECT (decoder, "activate: %d", result); -+ -+ return result; -+} -+ -+static gboolean -+gst_base_video_decoder_sink_activate_push (GstPad * pad, gboolean active) -+{ -+ gboolean result = TRUE; -+ GstBaseVideoDecoder *base_video_decoder; -+ -+ base_video_decoder = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); -+ -+ result = gst_base_video_decoder_sink_activate (base_video_decoder, active); -+ -+ gst_object_unref (base_video_decoder); -+ -+ return result; -+} -+ -+static gboolean -+gst_base_video_decoder_sink_setcaps (GstPad * pad, GstCaps * caps) -+{ -+ GstBaseVideoDecoder *base_video_decoder; -+ GstBaseVideoDecoderClass *base_video_decoder_class; -+ GstStructure *structure; -+ const GValue *codec_data; -+ gboolean res = TRUE; -+ -+ base_video_decoder = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); -+ base_video_decoder_class = -+ GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); -+ -+ GST_DEBUG ("setcaps %" GST_PTR_FORMAT, caps); -+ -+ if (base_video_decoder->codec_data) { -+ gst_buffer_unref (base_video_decoder->codec_data); -+ base_video_decoder->codec_data = NULL; -+ } -+ -+ structure = gst_caps_get_structure (caps, 0); -+ -+ codec_data = gst_structure_get_value (structure, "codec_data"); -+ if (codec_data && G_VALUE_TYPE (codec_data) == GST_TYPE_BUFFER) { -+ base_video_decoder->codec_data = gst_value_get_buffer (codec_data); -+ } -+ -+ if (base_video_decoder_class->set_sink_caps) -+ res = base_video_decoder_class->set_sink_caps (base_video_decoder, caps); -+ -+ g_object_unref (base_video_decoder); -+ -+ return res; -+} -+ -+static void -+gst_base_video_decoder_finalize (GObject * object) -+{ -+ GstBaseVideoDecoder *base_video_decoder; -+ GstBaseVideoDecoderClass *base_video_decoder_class; -+ -+ g_return_if_fail (GST_IS_BASE_VIDEO_DECODER (object)); -+ base_video_decoder = GST_BASE_VIDEO_DECODER (object); -+ base_video_decoder_class = GST_BASE_VIDEO_DECODER_GET_CLASS (object); -+ -+ gst_base_video_decoder_reset (base_video_decoder); -+ -+ GST_DEBUG_OBJECT (object, "finalize"); -+ -+ G_OBJECT_CLASS (parent_class)->finalize (object); -+} -+ -+static gboolean -+gst_base_video_decoder_sink_event (GstPad * pad, GstEvent * event) -+{ -+ GstBaseVideoDecoder *base_video_decoder; -+ GstBaseVideoDecoderClass *base_video_decoder_class; -+ gboolean ret = FALSE; -+ -+ base_video_decoder = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); -+ base_video_decoder_class = -+ GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); -+ -+ switch (GST_EVENT_TYPE (event)) { -+ case GST_EVENT_EOS: -+ { -+ GstVideoFrame *frame; -+ -+ frame = g_malloc0 (sizeof (GstVideoFrame)); -+ frame->presentation_frame_number = -+ base_video_decoder->presentation_frame_number; -+ frame->presentation_duration = 0; -+ base_video_decoder->presentation_frame_number++; -+ -+ base_video_decoder->frames = -+ g_list_append (base_video_decoder->frames, frame); -+ if (base_video_decoder_class->finish) { -+ base_video_decoder_class->finish (base_video_decoder, frame); -+ } -+ -+ ret = -+ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), -+ event); -+ } -+ break; -+ case GST_EVENT_NEWSEGMENT: -+ { -+ gboolean update; -+ double rate; -+ double applied_rate; -+ GstFormat format; -+ gint64 start; -+ gint64 stop; -+ gint64 position; -+ -+ gst_event_parse_new_segment_full (event, &update, &rate, -+ &applied_rate, &format, &start, &stop, &position); -+ -+ if (format != GST_FORMAT_TIME) -+ goto newseg_wrong_format; -+ -+ gst_segment_set_newsegment_full (&base_video_decoder->state.segment, -+ update, rate, applied_rate, format, start, stop, position); -+ GST_DEBUG ("new segment %" GST_SEGMENT_FORMAT, -+ &base_video_decoder->state.segment); -+ -+ ret = -+ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), -+ event); -+ } -+ break; -+ default: -+ /* FIXME this changes the order of events */ -+ ret = -+ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), -+ event); -+ break; -+ } -+ -+done: -+ gst_object_unref (base_video_decoder); -+ return ret; -+ -+newseg_wrong_format: -+ { -+ GST_DEBUG_OBJECT (base_video_decoder, "received non TIME newsegment"); -+ gst_event_unref (event); -+ goto done; -+ } -+} -+ -+static gboolean -+gst_base_video_decoder_src_event (GstPad * pad, GstEvent * event) -+{ -+ GstBaseVideoDecoder *base_video_decoder; -+ gboolean res = FALSE; -+ -+ base_video_decoder = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); -+ -+ switch (GST_EVENT_TYPE (event)) { -+ case GST_EVENT_SEEK: -+ { -+ GstFormat format, tformat; -+ gdouble rate; -+ GstEvent *real_seek; -+ GstSeekFlags flags; -+ GstSeekType cur_type, stop_type; -+ gint64 cur, stop; -+ gint64 tcur, tstop; -+ -+ gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, -+ &cur, &stop_type, &stop); -+ gst_event_unref (event); -+ -+ tformat = GST_FORMAT_TIME; -+ res = -+ gst_base_video_decoder_src_convert (pad, format, cur, &tformat, -+ &tcur); -+ if (!res) -+ goto convert_error; -+ res = -+ gst_base_video_decoder_src_convert (pad, format, stop, &tformat, -+ &tstop); -+ if (!res) -+ goto convert_error; -+ -+ real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME, -+ flags, cur_type, tcur, stop_type, tstop); -+ -+ res = -+ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SINK_PAD -+ (base_video_decoder), real_seek); -+ -+ break; -+ } -+ case GST_EVENT_QOS: -+ { -+ gdouble proportion; -+ GstClockTimeDiff diff; -+ GstClockTime timestamp; -+ -+ gst_event_parse_qos (event, &proportion, &diff, ×tamp); -+ -+ GST_OBJECT_LOCK (base_video_decoder); -+ base_video_decoder->proportion = proportion; -+ base_video_decoder->earliest_time = timestamp + diff; -+ GST_OBJECT_UNLOCK (base_video_decoder); -+ -+ GST_DEBUG_OBJECT (base_video_decoder, -+ "got QoS %" GST_TIME_FORMAT ", %" G_GINT64_FORMAT ", %g", -+ GST_TIME_ARGS (timestamp), diff, proportion); -+ -+ res = -+ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SINK_PAD -+ (base_video_decoder), event); -+ break; -+ } -+ default: -+ res = -+ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SINK_PAD -+ (base_video_decoder), event); -+ break; -+ } -+done: -+ gst_object_unref (base_video_decoder); -+ return res; -+ -+convert_error: -+ GST_DEBUG_OBJECT (base_video_decoder, "could not convert format"); -+ goto done; -+} -+ -+ -+#if 0 -+static gboolean -+gst_base_video_decoder_sink_convert (GstPad * pad, -+ GstFormat src_format, gint64 src_value, -+ GstFormat * dest_format, gint64 * dest_value) -+{ -+ gboolean res = TRUE; -+ GstBaseVideoDecoder *enc; -+ -+ if (src_format == *dest_format) { -+ *dest_value = src_value; -+ return TRUE; -+ } -+ -+ enc = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); -+ -+ /* FIXME: check if we are in a decoding state */ -+ -+ switch (src_format) { -+ case GST_FORMAT_BYTES: -+ switch (*dest_format) { -+#if 0 -+ case GST_FORMAT_DEFAULT: -+ *dest_value = gst_util_uint64_scale_int (src_value, 1, -+ enc->bytes_per_picture); -+ break; -+#endif -+ case GST_FORMAT_TIME: -+ /* seems like a rather silly conversion, implement me if you like */ -+ default: -+ res = FALSE; -+ } -+ break; -+ case GST_FORMAT_DEFAULT: -+ switch (*dest_format) { -+ case GST_FORMAT_TIME: -+ *dest_value = gst_util_uint64_scale (src_value, -+ GST_SECOND * enc->fps_d, enc->fps_n); -+ break; -+#if 0 -+ case GST_FORMAT_BYTES: -+ *dest_value = gst_util_uint64_scale_int (src_value, -+ enc->bytes_per_picture, 1); -+ break; -+#endif -+ default: -+ res = FALSE; -+ } -+ break; -+ default: -+ res = FALSE; -+ break; -+ } -+} -+#endif -+ -+static gboolean -+gst_base_video_decoder_src_convert (GstPad * pad, -+ GstFormat src_format, gint64 src_value, -+ GstFormat * dest_format, gint64 * dest_value) -+{ -+ gboolean res = TRUE; -+ GstBaseVideoDecoder *enc; -+ -+ if (src_format == *dest_format) { -+ *dest_value = src_value; -+ return TRUE; -+ } -+ -+ enc = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); -+ -+ /* FIXME: check if we are in a encoding state */ -+ -+ GST_DEBUG ("src convert"); -+ switch (src_format) { -+#if 0 -+ case GST_FORMAT_DEFAULT: -+ switch (*dest_format) { -+ case GST_FORMAT_TIME: -+ *dest_value = gst_util_uint64_scale (granulepos_to_frame (src_value), -+ enc->fps_d * GST_SECOND, enc->fps_n); -+ break; -+ default: -+ res = FALSE; -+ } -+ break; -+ case GST_FORMAT_TIME: -+ switch (*dest_format) { -+ case GST_FORMAT_DEFAULT: -+ { -+ *dest_value = gst_util_uint64_scale (src_value, -+ enc->fps_n, enc->fps_d * GST_SECOND); -+ break; -+ } -+ default: -+ res = FALSE; -+ break; -+ } -+ break; -+#endif -+ default: -+ res = FALSE; -+ break; -+ } -+ -+ gst_object_unref (enc); -+ -+ return res; -+} -+ -+static const GstQueryType * -+gst_base_video_decoder_get_query_types (GstPad * pad) -+{ -+ static const GstQueryType query_types[] = { -+ GST_QUERY_CONVERT, -+ 0 -+ }; -+ -+ return query_types; -+} -+ -+static gboolean -+gst_base_video_decoder_src_query (GstPad * pad, GstQuery * query) -+{ -+ GstBaseVideoDecoder *enc; -+ gboolean res; -+ -+ enc = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); -+ -+ switch GST_QUERY_TYPE -+ (query) { -+ case GST_QUERY_CONVERT: -+ { -+ GstFormat src_fmt, dest_fmt; -+ gint64 src_val, dest_val; -+ -+ gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); -+ res = -+ gst_base_video_decoder_src_convert (pad, src_fmt, src_val, &dest_fmt, -+ &dest_val); -+ if (!res) -+ goto error; -+ gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); -+ break; -+ } -+ default: -+ res = gst_pad_query_default (pad, query); -+ } -+ gst_object_unref (enc); -+ return res; -+ -+error: -+ GST_DEBUG_OBJECT (enc, "query failed"); -+ gst_object_unref (enc); -+ return res; -+} -+ -+static gboolean -+gst_base_video_decoder_sink_query (GstPad * pad, GstQuery * query) -+{ -+ GstBaseVideoDecoder *base_video_decoder; -+ gboolean res = FALSE; -+ -+ base_video_decoder = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); -+ -+ GST_DEBUG_OBJECT (base_video_decoder, "sink query fps=%d/%d", -+ base_video_decoder->state.fps_n, base_video_decoder->state.fps_d); -+ switch (GST_QUERY_TYPE (query)) { -+ case GST_QUERY_CONVERT: -+ { -+ GstFormat src_fmt, dest_fmt; -+ gint64 src_val, dest_val; -+ -+ gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); -+ res = gst_base_video_rawvideo_convert (&base_video_decoder->state, -+ src_fmt, src_val, &dest_fmt, &dest_val); -+ if (!res) -+ goto error; -+ gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); -+ break; -+ } -+ default: -+ res = gst_pad_query_default (pad, query); -+ break; -+ } -+done: -+ gst_object_unref (base_video_decoder); -+ -+ return res; -+error: -+ GST_DEBUG_OBJECT (base_video_decoder, "query failed"); -+ goto done; -+} -+ -+ -+#if 0 -+static gboolean -+gst_pad_is_negotiated (GstPad * pad) -+{ -+ GstCaps *caps; -+ -+ g_return_val_if_fail (pad != NULL, FALSE); -+ -+ caps = gst_pad_get_negotiated_caps (pad); -+ if (caps) { -+ gst_caps_unref (caps); -+ return TRUE; -+ } -+ -+ return FALSE; -+} -+#endif -+ -+static void -+gst_base_video_decoder_reset (GstBaseVideoDecoder * base_video_decoder) -+{ -+ GstBaseVideoDecoderClass *base_video_decoder_class; -+ GList *g; -+ -+ base_video_decoder_class = -+ GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); -+ -+ GST_DEBUG ("reset"); -+ -+ base_video_decoder->started = FALSE; -+ -+ base_video_decoder->discont = TRUE; -+ base_video_decoder->have_sync = FALSE; -+ -+ base_video_decoder->timestamp_offset = GST_CLOCK_TIME_NONE; -+ base_video_decoder->system_frame_number = 0; -+ base_video_decoder->presentation_frame_number = 0; -+ base_video_decoder->last_sink_timestamp = GST_CLOCK_TIME_NONE; -+ base_video_decoder->last_sink_offset_end = GST_CLOCK_TIME_NONE; -+ base_video_decoder->base_picture_number = 0; -+ base_video_decoder->last_timestamp = GST_CLOCK_TIME_NONE; -+ -+ base_video_decoder->offset = 0; -+ -+ if (base_video_decoder->caps) { -+ gst_caps_unref (base_video_decoder->caps); -+ base_video_decoder->caps = NULL; -+ } -+ -+ if (base_video_decoder->current_frame) { -+ gst_base_video_decoder_free_frame (base_video_decoder->current_frame); -+ base_video_decoder->current_frame = NULL; -+ } -+ -+ base_video_decoder->have_src_caps = FALSE; -+ -+ for (g = g_list_first (base_video_decoder->frames); g; g = g_list_next (g)) { -+ GstVideoFrame *frame = g->data; -+ gst_base_video_decoder_free_frame (frame); -+ } -+ g_list_free (base_video_decoder->frames); -+ base_video_decoder->frames = NULL; -+ -+ if (base_video_decoder_class->reset) { -+ base_video_decoder_class->reset (base_video_decoder); -+ } -+} -+ -+static GstBuffer * -+gst_adapter_get_buffer (GstAdapter * adapter) -+{ -+ return gst_buffer_ref (GST_BUFFER (adapter->buflist->data)); -+ -+} -+ -+static GstFlowReturn -+gst_base_video_decoder_chain (GstPad * pad, GstBuffer * buf) -+{ -+ GstBaseVideoDecoder *base_video_decoder; -+ GstBaseVideoDecoderClass *klass; -+ GstBuffer *buffer; -+ GstFlowReturn ret; -+ -+ GST_DEBUG ("chain %" G_GINT64_FORMAT, GST_BUFFER_TIMESTAMP (buf)); -+ -+#if 0 -+ /* requiring the pad to be negotiated makes it impossible to use -+ * oggdemux or filesrc ! decoder */ -+ if (!gst_pad_is_negotiated (pad)) { -+ GST_DEBUG ("not negotiated"); -+ return GST_FLOW_NOT_NEGOTIATED; -+ } -+#endif -+ -+ base_video_decoder = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); -+ klass = GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); -+ -+ GST_DEBUG_OBJECT (base_video_decoder, "chain"); -+ -+ if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DISCONT))) { -+ GST_DEBUG_OBJECT (base_video_decoder, "received DISCONT buffer"); -+ if (base_video_decoder->started) { -+ gst_base_video_decoder_reset (base_video_decoder); -+ } -+ } -+ -+ if (!base_video_decoder->started) { -+ klass->start (base_video_decoder); -+ base_video_decoder->started = TRUE; -+ } -+ -+ if (GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) { -+ GST_DEBUG ("timestamp %" G_GINT64_FORMAT " offset %" G_GINT64_FORMAT, -+ GST_BUFFER_TIMESTAMP (buf), base_video_decoder->offset); -+ base_video_decoder->last_sink_timestamp = GST_BUFFER_TIMESTAMP (buf); -+ } -+ if (GST_BUFFER_OFFSET_END (buf) != -1) { -+ GST_DEBUG ("gp %" G_GINT64_FORMAT, GST_BUFFER_OFFSET_END (buf)); -+ base_video_decoder->last_sink_offset_end = GST_BUFFER_OFFSET_END (buf); -+ } -+ base_video_decoder->offset += GST_BUFFER_SIZE (buf); -+ -+#if 0 -+ if (base_video_decoder->timestamp_offset == GST_CLOCK_TIME_NONE && -+ GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) { -+ GST_DEBUG ("got new offset %lld", GST_BUFFER_TIMESTAMP (buf)); -+ base_video_decoder->timestamp_offset = GST_BUFFER_TIMESTAMP (buf); -+ } -+#endif -+ -+ if (base_video_decoder->current_frame == NULL) { -+ base_video_decoder->current_frame = -+ gst_base_video_decoder_new_frame (base_video_decoder); -+ } -+ -+ gst_adapter_push (base_video_decoder->input_adapter, buf); -+ -+ if (!base_video_decoder->have_sync) { -+ int n, m; -+ -+ GST_DEBUG ("no sync, scanning"); -+ -+ n = gst_adapter_available (base_video_decoder->input_adapter); -+ m = klass->scan_for_sync (base_video_decoder, FALSE, 0, n); -+ -+ if (m < 0) { -+ g_warning ("subclass returned negative scan %d", m); -+ } -+ -+ if (m >= n) { -+ g_warning ("subclass scanned past end %d >= %d", m, n); -+ } -+ -+ gst_adapter_flush (base_video_decoder->input_adapter, m); -+ -+ if (m < n) { -+ GST_DEBUG ("found possible sync after %d bytes (of %d)", m, n); -+ -+ /* this is only "maybe" sync */ -+ base_video_decoder->have_sync = TRUE; -+ } -+ -+ if (!base_video_decoder->have_sync) { -+ gst_object_unref (base_video_decoder); -+ return GST_FLOW_OK; -+ } -+ } -+ -+ /* FIXME: use gst_adapter_prev_timestamp() here instead? */ -+ buffer = gst_adapter_get_buffer (base_video_decoder->input_adapter); -+ -+ base_video_decoder->buffer_timestamp = GST_BUFFER_TIMESTAMP (buffer); -+ gst_buffer_unref (buffer); -+ -+ do { -+ ret = klass->parse_data (base_video_decoder, FALSE); -+ } while (ret == GST_FLOW_OK); -+ -+ if (ret == GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA) { -+ gst_object_unref (base_video_decoder); -+ return GST_FLOW_OK; -+ } -+ -+ gst_object_unref (base_video_decoder); -+ return ret; -+} -+ -+static GstStateChangeReturn -+gst_base_video_decoder_change_state (GstElement * element, -+ GstStateChange transition) -+{ -+ GstBaseVideoDecoder *base_video_decoder; -+ GstBaseVideoDecoderClass *base_video_decoder_class; -+ GstStateChangeReturn ret; -+ -+ base_video_decoder = GST_BASE_VIDEO_DECODER (element); -+ base_video_decoder_class = GST_BASE_VIDEO_DECODER_GET_CLASS (element); -+ -+ switch (transition) { -+ default: -+ break; -+ } -+ -+ ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); -+ -+ switch (transition) { -+ case GST_STATE_CHANGE_PAUSED_TO_READY: -+ break; -+ default: -+ break; -+ } -+ -+ return ret; -+} -+ -+static void -+gst_base_video_decoder_free_frame (GstVideoFrame * frame) -+{ -+ g_return_if_fail (frame != NULL); -+ -+ if (frame->sink_buffer) { -+ gst_buffer_unref (frame->sink_buffer); -+ } -+#if 0 -+ if (frame->src_buffer) { -+ gst_buffer_unref (frame->src_buffer); -+ } -+#endif -+ -+ g_free (frame); -+} -+ -+static GstVideoFrame * -+gst_base_video_decoder_new_frame (GstBaseVideoDecoder * base_video_decoder) -+{ -+ GstVideoFrame *frame; -+ -+ frame = g_malloc0 (sizeof (GstVideoFrame)); -+ -+ frame->system_frame_number = base_video_decoder->system_frame_number; -+ base_video_decoder->system_frame_number++; -+ -+ frame->decode_frame_number = frame->system_frame_number - -+ base_video_decoder->reorder_depth; -+ -+ frame->decode_timestamp = -1; -+ frame->presentation_timestamp = -1; -+ frame->presentation_duration = -1; -+ frame->n_fields = 2; -+ -+ return frame; -+} -+ -+GstFlowReturn -+gst_base_video_decoder_finish_frame (GstBaseVideoDecoder * base_video_decoder, -+ GstVideoFrame * frame) -+{ -+ GstBaseVideoDecoderClass *base_video_decoder_class; -+ GstBuffer *src_buffer; -+ -+ GST_DEBUG ("finish frame"); -+ -+ base_video_decoder_class = -+ GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); -+ -+ GST_DEBUG ("finish frame sync=%d pts=%" G_GINT64_FORMAT, frame->is_sync_point, -+ frame->presentation_timestamp); -+ -+ if (frame->is_sync_point) { -+ if (GST_CLOCK_TIME_IS_VALID (frame->presentation_timestamp)) { -+ if (frame->presentation_timestamp != base_video_decoder->timestamp_offset) { -+ GST_DEBUG ("sync timestamp %" G_GINT64_FORMAT " diff %" G_GINT64_FORMAT, -+ frame->presentation_timestamp, -+ frame->presentation_timestamp - -+ base_video_decoder->state.segment.start); -+ base_video_decoder->timestamp_offset = frame->presentation_timestamp; -+ base_video_decoder->field_index = 0; -+ } else { -+ /* This case is for one initial timestamp and no others, e.g., -+ * filesrc ! decoder ! xvimagesink */ -+ GST_WARNING ("sync timestamp didn't change, ignoring"); -+ frame->presentation_timestamp = GST_CLOCK_TIME_NONE; -+ } -+ } else { -+ GST_WARNING ("sync point doesn't have timestamp"); -+ if (GST_CLOCK_TIME_IS_VALID (base_video_decoder->timestamp_offset)) { -+ GST_ERROR ("No base timestamp. Assuming frames start at 0"); -+ base_video_decoder->timestamp_offset = 0; -+ base_video_decoder->field_index = 0; -+ } -+ } -+ } -+ frame->field_index = base_video_decoder->field_index; -+ base_video_decoder->field_index += frame->n_fields; -+ -+ if (frame->presentation_timestamp == GST_CLOCK_TIME_NONE) { -+ frame->presentation_timestamp = -+ gst_base_video_decoder_get_field_timestamp (base_video_decoder, -+ frame->field_index); -+ frame->presentation_duration = GST_CLOCK_TIME_NONE; -+ frame->decode_timestamp = -+ gst_base_video_decoder_get_timestamp (base_video_decoder, -+ frame->decode_frame_number); -+ } -+ if (frame->presentation_duration == GST_CLOCK_TIME_NONE) { -+ frame->presentation_duration = -+ gst_base_video_decoder_get_field_timestamp (base_video_decoder, -+ frame->field_index + frame->n_fields) - frame->presentation_timestamp; -+ } -+ -+ if (GST_CLOCK_TIME_IS_VALID (base_video_decoder->last_timestamp)) { -+ if (frame->presentation_timestamp < base_video_decoder->last_timestamp) { -+ GST_WARNING ("decreasing timestamp (%" G_GINT64_FORMAT " < %" -+ G_GINT64_FORMAT ")", frame->presentation_timestamp, -+ base_video_decoder->last_timestamp); -+ } -+ } -+ base_video_decoder->last_timestamp = frame->presentation_timestamp; -+ -+ GST_BUFFER_FLAG_UNSET (frame->src_buffer, GST_BUFFER_FLAG_DELTA_UNIT); -+ if (base_video_decoder->state.interlaced) { -+#ifndef GST_VIDEO_BUFFER_TFF -+#define GST_VIDEO_BUFFER_TFF (GST_MINI_OBJECT_FLAG_LAST << 5) -+#endif -+#ifndef GST_VIDEO_BUFFER_RFF -+#define GST_VIDEO_BUFFER_RFF (GST_MINI_OBJECT_FLAG_LAST << 6) -+#endif -+#ifndef GST_VIDEO_BUFFER_ONEFIELD -+#define GST_VIDEO_BUFFER_ONEFIELD (GST_MINI_OBJECT_FLAG_LAST << 7) -+#endif -+ int tff = base_video_decoder->state.top_field_first; -+ -+ if (frame->field_index & 1) { -+ tff ^= 1; -+ } -+ if (tff) { -+ GST_BUFFER_FLAG_SET (frame->src_buffer, GST_VIDEO_BUFFER_TFF); -+ } else { -+ GST_BUFFER_FLAG_UNSET (frame->src_buffer, GST_VIDEO_BUFFER_TFF); -+ } -+ GST_BUFFER_FLAG_UNSET (frame->src_buffer, GST_VIDEO_BUFFER_RFF); -+ GST_BUFFER_FLAG_UNSET (frame->src_buffer, GST_VIDEO_BUFFER_ONEFIELD); -+ if (frame->n_fields == 3) { -+ GST_BUFFER_FLAG_SET (frame->src_buffer, GST_VIDEO_BUFFER_RFF); -+ } else if (frame->n_fields == 1) { -+ GST_BUFFER_FLAG_UNSET (frame->src_buffer, GST_VIDEO_BUFFER_ONEFIELD); -+ } -+ } -+ -+ GST_BUFFER_TIMESTAMP (frame->src_buffer) = frame->presentation_timestamp; -+ GST_BUFFER_DURATION (frame->src_buffer) = frame->presentation_duration; -+ GST_BUFFER_OFFSET (frame->src_buffer) = -1; -+ GST_BUFFER_OFFSET_END (frame->src_buffer) = -1; -+ -+ GST_DEBUG ("pushing frame %" G_GINT64_FORMAT, frame->presentation_timestamp); -+ -+ base_video_decoder->frames = -+ g_list_remove (base_video_decoder->frames, frame); -+ -+ gst_base_video_decoder_set_src_caps (base_video_decoder); -+ -+ src_buffer = frame->src_buffer; -+ frame->src_buffer = NULL; -+ -+ gst_base_video_decoder_free_frame (frame); -+ -+ if (base_video_decoder->sink_clipping) { -+ gint64 start = GST_BUFFER_TIMESTAMP (src_buffer); -+ gint64 stop = GST_BUFFER_TIMESTAMP (src_buffer) + -+ GST_BUFFER_DURATION (src_buffer); -+ -+ if (gst_segment_clip (&base_video_decoder->state.segment, GST_FORMAT_TIME, -+ start, stop, &start, &stop)) { -+ GST_BUFFER_TIMESTAMP (src_buffer) = start; -+ GST_BUFFER_DURATION (src_buffer) = stop - start; -+ } else { -+ GST_DEBUG ("dropping buffer outside segment"); -+ gst_buffer_unref (src_buffer); -+ return GST_FLOW_OK; -+ } -+ } -+ -+ return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), -+ src_buffer); -+} -+ -+int -+gst_base_video_decoder_get_height (GstBaseVideoDecoder * base_video_decoder) -+{ -+ return base_video_decoder->state.height; -+} -+ -+int -+gst_base_video_decoder_get_width (GstBaseVideoDecoder * base_video_decoder) -+{ -+ return base_video_decoder->state.width; -+} -+ -+GstFlowReturn -+gst_base_video_decoder_end_of_stream (GstBaseVideoDecoder * base_video_decoder, -+ GstBuffer * buffer) -+{ -+ -+ if (base_video_decoder->frames) { -+ GST_DEBUG ("EOS with frames left over"); -+ } -+ -+ return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), -+ buffer); -+} -+ -+void -+gst_base_video_decoder_add_to_frame (GstBaseVideoDecoder * base_video_decoder, -+ int n_bytes) -+{ -+ GstBuffer *buf; -+ -+ GST_DEBUG ("add to frame"); -+ -+#if 0 -+ if (gst_adapter_available (base_video_decoder->output_adapter) == 0) { -+ GstBuffer *buffer; -+ -+ buffer = -+ gst_adapter_get_orig_buffer_at_offset -+ (base_video_decoder->input_adapter, 0); -+ if (buffer) { -+ base_video_decoder->current_frame->presentation_timestamp = -+ GST_BUFFER_TIMESTAMP (buffer); -+ gst_buffer_unref (buffer); -+ } -+ } -+#endif -+ -+ if (n_bytes == 0) -+ return; -+ -+ buf = gst_adapter_take_buffer (base_video_decoder->input_adapter, n_bytes); -+ -+ gst_adapter_push (base_video_decoder->output_adapter, buf); -+} -+ -+static guint64 -+gst_base_video_decoder_get_timestamp (GstBaseVideoDecoder * base_video_decoder, -+ int picture_number) -+{ -+ if (base_video_decoder->state.fps_d == 0) { -+ return -1; -+ } -+ if (picture_number < base_video_decoder->base_picture_number) { -+ return base_video_decoder->timestamp_offset - -+ (gint64) gst_util_uint64_scale (base_video_decoder->base_picture_number -+ - picture_number, base_video_decoder->state.fps_d * GST_SECOND, -+ base_video_decoder->state.fps_n); -+ } else { -+ return base_video_decoder->timestamp_offset + -+ gst_util_uint64_scale (picture_number - -+ base_video_decoder->base_picture_number, -+ base_video_decoder->state.fps_d * GST_SECOND, -+ base_video_decoder->state.fps_n); -+ } -+} -+ -+static guint64 -+gst_base_video_decoder_get_field_timestamp (GstBaseVideoDecoder * -+ base_video_decoder, int field_offset) -+{ -+ if (base_video_decoder->state.fps_d == 0) { -+ return GST_CLOCK_TIME_NONE; -+ } -+ if (field_offset < 0) { -+ GST_WARNING ("field offset < 0"); -+ return GST_CLOCK_TIME_NONE; -+ } -+ return base_video_decoder->timestamp_offset + -+ gst_util_uint64_scale (field_offset, -+ base_video_decoder->state.fps_d * GST_SECOND, -+ base_video_decoder->state.fps_n * 2); -+} -+ -+ -+GstFlowReturn -+gst_base_video_decoder_have_frame (GstBaseVideoDecoder * base_video_decoder) -+{ -+ GstVideoFrame *frame = base_video_decoder->current_frame; -+ GstBuffer *buffer; -+ GstBaseVideoDecoderClass *base_video_decoder_class; -+ GstFlowReturn ret = GST_FLOW_OK; -+ int n_available; -+ -+ GST_DEBUG ("have_frame"); -+ -+ base_video_decoder_class = -+ GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); -+ -+ n_available = gst_adapter_available (base_video_decoder->output_adapter); -+ if (n_available) { -+ buffer = gst_adapter_take_buffer (base_video_decoder->output_adapter, -+ n_available); -+ } else { -+ buffer = gst_buffer_new_and_alloc (0); -+ } -+ -+ frame->distance_from_sync = base_video_decoder->distance_from_sync; -+ base_video_decoder->distance_from_sync++; -+ -+#if 0 -+ if (frame->presentation_timestamp == GST_CLOCK_TIME_NONE) { -+ frame->presentation_timestamp = -+ gst_base_video_decoder_get_timestamp (base_video_decoder, -+ frame->presentation_frame_number); -+ frame->presentation_duration = -+ gst_base_video_decoder_get_timestamp (base_video_decoder, -+ frame->presentation_frame_number + 1) - frame->presentation_timestamp; -+ frame->decode_timestamp = -+ gst_base_video_decoder_get_timestamp (base_video_decoder, -+ frame->decode_frame_number); -+ } -+#endif -+ -+#if 0 -+ GST_BUFFER_TIMESTAMP (buffer) = frame->presentation_timestamp; -+ GST_BUFFER_DURATION (buffer) = frame->presentation_duration; -+ if (frame->decode_frame_number < 0) { -+ GST_BUFFER_OFFSET (buffer) = 0; -+ } else { -+ GST_BUFFER_OFFSET (buffer) = frame->decode_timestamp; -+ } -+ GST_BUFFER_OFFSET_END (buffer) = GST_CLOCK_TIME_NONE; -+#endif -+ -+ GST_DEBUG ("pts %" GST_TIME_FORMAT, -+ GST_TIME_ARGS (frame->presentation_timestamp)); -+ GST_DEBUG ("dts %" GST_TIME_FORMAT, GST_TIME_ARGS (frame->decode_timestamp)); -+ GST_DEBUG ("dist %d", frame->distance_from_sync); -+ -+ if (frame->is_sync_point) { -+ GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DELTA_UNIT); -+ } else { -+ GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT); -+ } -+ if (base_video_decoder->discont) { -+ GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT); -+ base_video_decoder->discont = FALSE; -+ } -+ -+ frame->sink_buffer = buffer; -+ -+ base_video_decoder->frames = g_list_append (base_video_decoder->frames, -+ frame); -+ -+ /* do something with frame */ -+ ret = base_video_decoder_class->handle_frame (base_video_decoder, frame); -+ if (!GST_FLOW_IS_SUCCESS (ret)) { -+ GST_DEBUG ("flow error!"); -+ } -+ -+ /* create new frame */ -+ base_video_decoder->current_frame = -+ gst_base_video_decoder_new_frame (base_video_decoder); -+ -+ return ret; -+} -+ -+GstVideoState * -+gst_base_video_decoder_get_state (GstBaseVideoDecoder * base_video_decoder) -+{ -+ return &base_video_decoder->state; -+ -+} -+ -+void -+gst_base_video_decoder_set_state (GstBaseVideoDecoder * base_video_decoder, -+ GstVideoState * state) -+{ -+ memcpy (&base_video_decoder->state, state, sizeof (*state)); -+ -+} -+ -+void -+gst_base_video_decoder_lost_sync (GstBaseVideoDecoder * base_video_decoder) -+{ -+ g_return_if_fail (GST_IS_BASE_VIDEO_DECODER (base_video_decoder)); -+ -+ GST_DEBUG ("lost_sync"); -+ -+ if (gst_adapter_available (base_video_decoder->input_adapter) >= 1) { -+ gst_adapter_flush (base_video_decoder->input_adapter, 1); -+ } -+ -+ base_video_decoder->have_sync = FALSE; -+} -+ -+void -+gst_base_video_decoder_set_sync_point (GstBaseVideoDecoder * base_video_decoder) -+{ -+ GST_DEBUG ("set_sync_point"); -+ -+ base_video_decoder->current_frame->is_sync_point = TRUE; -+ base_video_decoder->distance_from_sync = 0; -+ -+ base_video_decoder->current_frame->presentation_timestamp = -+ base_video_decoder->last_sink_timestamp; -+ -+ -+} -+ -+GstVideoFrame * -+gst_base_video_decoder_get_frame (GstBaseVideoDecoder * base_video_decoder, -+ int frame_number) -+{ -+ GList *g; -+ -+ for (g = g_list_first (base_video_decoder->frames); g; g = g_list_next (g)) { -+ GstVideoFrame *frame = g->data; -+ -+ if (frame->system_frame_number == frame_number) { -+ return frame; -+ } -+ } -+ -+ return NULL; -+} -+ -+void -+gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder) -+{ -+ GstCaps *caps; -+ GstVideoState *state = &base_video_decoder->state; -+ -+ if (base_video_decoder->have_src_caps) -+ return; -+ -+ caps = gst_video_format_new_caps (state->format, -+ state->width, state->height, -+ state->fps_n, state->fps_d, state->par_n, state->par_d); -+ gst_caps_set_simple (caps, "interlaced", -+ G_TYPE_BOOLEAN, state->interlaced, NULL); -+ -+ GST_DEBUG ("setting caps %" GST_PTR_FORMAT, caps); -+ -+ gst_pad_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), caps); -+ -+ base_video_decoder->have_src_caps = TRUE; -+} -diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideodecoder.h schroedinger-1.0.8/gst-libs/gst/video/gstbasevideodecoder.h ---- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideodecoder.h 1970-01-01 01:00:00.000000000 +0100 -+++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideodecoder.h 2009-10-12 12:23:39.000000000 +0200 -@@ -0,0 +1,163 @@ -+/* GStreamer -+ * Copyright (C) 2008 David Schleef -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Library General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Library General Public License for more details. -+ * -+ * You should have received a copy of the GNU Library 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. -+ */ -+ -+#ifndef _GST_BASE_VIDEO_DECODER_H_ -+#define _GST_BASE_VIDEO_DECODER_H_ -+ -+#ifndef GST_USE_UNSTABLE_API -+#warning "GstBaseVideoDecoder is unstable API and may change in future." -+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning." -+#endif -+ -+#include -+ -+G_BEGIN_DECLS -+ -+#define GST_TYPE_BASE_VIDEO_DECODER \ -+ (gst_base_video_decoder_get_type()) -+#define GST_BASE_VIDEO_DECODER(obj) \ -+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_VIDEO_DECODER,GstBaseVideoDecoder)) -+#define GST_BASE_VIDEO_DECODER_CLASS(klass) \ -+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_VIDEO_DECODER,GstBaseVideoDecoderClass)) -+#define GST_BASE_VIDEO_DECODER_GET_CLASS(obj) \ -+ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_VIDEO_DECODER,GstBaseVideoDecoderClass)) -+#define GST_IS_BASE_VIDEO_DECODER(obj) \ -+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_VIDEO_DECODER)) -+#define GST_IS_BASE_VIDEO_DECODER_CLASS(obj) \ -+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_VIDEO_DECODER)) -+ -+/** -+ * GST_BASE_VIDEO_DECODER_SINK_NAME: -+ * -+ * The name of the templates for the sink pad. -+ */ -+#define GST_BASE_VIDEO_DECODER_SINK_NAME "sink" -+/** -+ * GST_BASE_VIDEO_DECODER_SRC_NAME: -+ * -+ * The name of the templates for the source pad. -+ */ -+#define GST_BASE_VIDEO_DECODER_SRC_NAME "src" -+ -+/** -+ * GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA: -+ * -+ * Custom GstFlowReturn value indicating that more data is needed. -+ */ -+#define GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA GST_FLOW_CUSTOM_SUCCESS -+ -+ -+typedef struct _GstBaseVideoDecoder GstBaseVideoDecoder; -+typedef struct _GstBaseVideoDecoderClass GstBaseVideoDecoderClass; -+ -+struct _GstBaseVideoDecoder -+{ -+ GstBaseVideoCodec base_video_codec; -+ -+ /*< private >*/ -+ GstAdapter *input_adapter; -+ GstAdapter *output_adapter; -+ -+ GList *frames; -+ -+ gboolean have_sync; -+ gboolean discont; -+ gboolean started; -+ -+ GstVideoState state; -+ -+ gboolean sink_clipping; -+ -+ guint64 presentation_frame_number; -+ guint64 system_frame_number; -+ -+ GstCaps *caps; -+ gboolean have_src_caps; -+ -+ GstVideoFrame *current_frame; -+ -+ int distance_from_sync; -+ int reorder_depth; -+ -+ GstClockTime buffer_timestamp; -+ -+ GstClockTime timestamp_offset; -+ -+ gdouble proportion; -+ GstClockTime earliest_time; -+ -+ GstBuffer *codec_data; -+ -+ guint64 offset; -+ GstClockTime last_timestamp; -+ -+ GstClockTime last_sink_timestamp; -+ GstClockTime last_sink_offset_end; -+ guint64 base_picture_number; -+ -+ int field_index; -+}; -+ -+struct _GstBaseVideoDecoderClass -+{ -+ GstBaseVideoCodecClass base_video_codec_class; -+ -+ gboolean (*set_sink_caps) (GstBaseVideoDecoder *coder, GstCaps *caps); -+ gboolean (*start) (GstBaseVideoDecoder *coder); -+ gboolean (*stop) (GstBaseVideoDecoder *coder); -+ gboolean (*reset) (GstBaseVideoDecoder *coder); -+ int (*scan_for_sync) (GstBaseVideoDecoder *decoder, gboolean at_eos, -+ int offset, int n); -+ GstFlowReturn (*parse_data) (GstBaseVideoDecoder *decoder, gboolean at_eos); -+ gboolean (*finish) (GstBaseVideoDecoder *coder, GstVideoFrame *frame); -+ GstFlowReturn (*handle_frame) (GstBaseVideoDecoder *coder, GstVideoFrame *frame); -+ GstFlowReturn (*shape_output) (GstBaseVideoDecoder *coder, GstVideoFrame *frame); -+ GstCaps *(*get_caps) (GstBaseVideoDecoder *coder); -+}; -+ -+GType gst_base_video_decoder_get_type (void); -+ -+int gst_base_video_decoder_get_width (GstBaseVideoDecoder *coder); -+int gst_base_video_decoder_get_height (GstBaseVideoDecoder *coder); -+ -+guint64 gst_base_video_decoder_get_timestamp_offset (GstBaseVideoDecoder *coder); -+ -+GstVideoFrame *gst_base_video_decoder_get_frame (GstBaseVideoDecoder *coder, -+ int frame_number); -+void gst_base_video_decoder_add_to_frame (GstBaseVideoDecoder *base_video_decoder, -+ int n_bytes); -+GstFlowReturn gst_base_video_decoder_finish_frame (GstBaseVideoDecoder *base_video_decoder, -+ GstVideoFrame *frame); -+GstFlowReturn gst_base_video_decoder_end_of_stream (GstBaseVideoDecoder *base_video_decoder, -+ GstBuffer *buffer); -+GstFlowReturn -+gst_base_video_decoder_have_frame (GstBaseVideoDecoder *base_video_decoder); -+GstVideoState * gst_base_video_decoder_get_state (GstBaseVideoDecoder *base_video_decoder); -+void gst_base_video_decoder_set_state (GstBaseVideoDecoder *base_video_decoder, -+ GstVideoState *state); -+void gst_base_video_decoder_lost_sync (GstBaseVideoDecoder *base_video_decoder); -+void gst_base_video_decoder_set_sync_point (GstBaseVideoDecoder *base_video_decoder); -+ -+void gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder *base_video_decoder); -+ -+ -+G_END_DECLS -+ -+#endif -+ -diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoencoder.c schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoencoder.c ---- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoencoder.c 1970-01-01 01:00:00.000000000 +0100 -+++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoencoder.c 2009-10-12 12:23:39.000000000 +0200 -@@ -0,0 +1,521 @@ -+/* GStreamer -+ * Copyright (C) 2008 David Schleef -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Library General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Library General Public License for more details. -+ * -+ * You should have received a copy of the GNU Library 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. -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+ -+#include "gstbasevideoencoder.h" -+#include "gstbasevideoutils.h" -+ -+GST_DEBUG_CATEGORY_EXTERN (basevideo_debug); -+#define GST_CAT_DEFAULT basevideo_debug -+ -+static void gst_base_video_encoder_finalize (GObject * object); -+ -+static gboolean gst_base_video_encoder_sink_setcaps (GstPad * pad, -+ GstCaps * caps); -+static gboolean gst_base_video_encoder_sink_event (GstPad * pad, -+ GstEvent * event); -+static GstFlowReturn gst_base_video_encoder_chain (GstPad * pad, -+ GstBuffer * buf); -+static GstStateChangeReturn gst_base_video_encoder_change_state (GstElement * -+ element, GstStateChange transition); -+static const GstQueryType *gst_base_video_encoder_get_query_types (GstPad * -+ pad); -+static gboolean gst_base_video_encoder_src_query (GstPad * pad, -+ GstQuery * query); -+ -+static void -+_do_init (GType object_type) -+{ -+ const GInterfaceInfo preset_interface_info = { -+ NULL, /* interface_init */ -+ NULL, /* interface_finalize */ -+ NULL /* interface_data */ -+ }; -+ -+ g_type_add_interface_static (object_type, GST_TYPE_PRESET, -+ &preset_interface_info); -+} -+ -+GST_BOILERPLATE_FULL (GstBaseVideoEncoder, gst_base_video_encoder, -+ GstBaseVideoCodec, GST_TYPE_BASE_VIDEO_CODEC, _do_init); -+ -+static void -+gst_base_video_encoder_base_init (gpointer g_class) -+{ -+ -+} -+ -+static void -+gst_base_video_encoder_class_init (GstBaseVideoEncoderClass * klass) -+{ -+ GObjectClass *gobject_class; -+ GstElementClass *gstelement_class; -+ -+ gobject_class = G_OBJECT_CLASS (klass); -+ gstelement_class = GST_ELEMENT_CLASS (klass); -+ -+ gobject_class->finalize = gst_base_video_encoder_finalize; -+ -+ gstelement_class->change_state = gst_base_video_encoder_change_state; -+ -+ parent_class = g_type_class_peek_parent (klass); -+} -+ -+static void -+gst_base_video_encoder_init (GstBaseVideoEncoder * base_video_encoder, -+ GstBaseVideoEncoderClass * klass) -+{ -+ GstPad *pad; -+ -+ GST_DEBUG ("gst_base_video_encoder_init"); -+ -+ pad = GST_BASE_VIDEO_CODEC_SINK_PAD (base_video_encoder); -+ -+ gst_pad_set_chain_function (pad, gst_base_video_encoder_chain); -+ gst_pad_set_event_function (pad, gst_base_video_encoder_sink_event); -+ gst_pad_set_setcaps_function (pad, gst_base_video_encoder_sink_setcaps); -+ -+ pad = GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder); -+ -+ gst_pad_set_query_type_function (pad, gst_base_video_encoder_get_query_types); -+ gst_pad_set_query_function (pad, gst_base_video_encoder_src_query); -+} -+ -+static gboolean -+gst_base_video_encoder_sink_setcaps (GstPad * pad, GstCaps * caps) -+{ -+ GstBaseVideoEncoder *base_video_encoder; -+ GstBaseVideoEncoderClass *base_video_encoder_class; -+ gboolean res; -+ -+ base_video_encoder = GST_BASE_VIDEO_ENCODER (gst_pad_get_parent (pad)); -+ base_video_encoder_class = -+ GST_BASE_VIDEO_ENCODER_GET_CLASS (base_video_encoder); -+ -+ GST_DEBUG ("setcaps"); -+ -+ gst_base_video_state_from_caps (&base_video_encoder->state, caps); -+ -+ res = base_video_encoder_class->set_format (base_video_encoder, -+ &base_video_encoder->state); -+ -+ base_video_encoder_class->start (base_video_encoder); -+ -+ g_object_unref (base_video_encoder); -+ -+ return res; -+} -+ -+static void -+gst_base_video_encoder_finalize (GObject * object) -+{ -+ GstBaseVideoEncoder *base_video_encoder; -+ GstBaseVideoEncoderClass *base_video_encoder_class; -+ -+ g_return_if_fail (GST_IS_BASE_VIDEO_ENCODER (object)); -+ base_video_encoder = GST_BASE_VIDEO_ENCODER (object); -+ base_video_encoder_class = GST_BASE_VIDEO_ENCODER_GET_CLASS (object); -+ -+ GST_DEBUG ("finalize"); -+ -+ G_OBJECT_CLASS (parent_class)->finalize (object); -+} -+ -+static gboolean -+gst_base_video_encoder_sink_event (GstPad * pad, GstEvent * event) -+{ -+ GstBaseVideoEncoder *base_video_encoder; -+ GstBaseVideoEncoderClass *base_video_encoder_class; -+ gboolean ret = FALSE; -+ -+ base_video_encoder = GST_BASE_VIDEO_ENCODER (gst_pad_get_parent (pad)); -+ base_video_encoder_class = -+ GST_BASE_VIDEO_ENCODER_GET_CLASS (base_video_encoder); -+ -+ switch (GST_EVENT_TYPE (event)) { -+ case GST_EVENT_EOS: -+ { -+ GstVideoFrame *frame; -+ -+ frame = g_malloc0 (sizeof (GstVideoFrame)); -+ frame->presentation_frame_number = -+ base_video_encoder->presentation_frame_number; -+ frame->presentation_duration = 0; -+ frame->is_eos = TRUE; -+ base_video_encoder->presentation_frame_number++; -+ -+ base_video_encoder->frames = -+ g_list_append (base_video_encoder->frames, frame); -+ base_video_encoder_class->finish (base_video_encoder, frame); -+ -+ ret = -+ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), -+ event); -+ } -+ break; -+ case GST_EVENT_NEWSEGMENT: -+ { -+ gboolean update; -+ double rate; -+ double applied_rate; -+ GstFormat format; -+ gint64 start; -+ gint64 stop; -+ gint64 position; -+ -+ gst_event_parse_new_segment_full (event, &update, &rate, -+ &applied_rate, &format, &start, &stop, &position); -+ -+ if (format != GST_FORMAT_TIME) -+ goto newseg_wrong_format; -+ -+ GST_DEBUG ("new segment %" G_GINT64_FORMAT " %" G_GINT64_FORMAT, start, -+ position); -+ -+ gst_segment_set_newsegment_full (&base_video_encoder->state.segment, -+ update, rate, applied_rate, format, start, stop, position); -+ -+ ret = -+ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), -+ event); -+ } -+ break; -+ default: -+ /* FIXME this changes the order of events */ -+ ret = -+ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), -+ event); -+ break; -+ } -+ -+done: -+ gst_object_unref (base_video_encoder); -+ return ret; -+ -+newseg_wrong_format: -+ { -+ GST_DEBUG_OBJECT (base_video_encoder, "received non TIME newsegment"); -+ gst_event_unref (event); -+ goto done; -+ } -+} -+ -+static const GstQueryType * -+gst_base_video_encoder_get_query_types (GstPad * pad) -+{ -+ static const GstQueryType query_types[] = { -+ GST_QUERY_CONVERT, -+ GST_QUERY_LATENCY, -+ 0 -+ }; -+ -+ return query_types; -+} -+ -+static gboolean -+gst_base_video_encoder_src_query (GstPad * pad, GstQuery * query) -+{ -+ GstBaseVideoEncoder *enc; -+ gboolean res; -+ GstPad *peerpad; -+ -+ enc = GST_BASE_VIDEO_ENCODER (gst_pad_get_parent (pad)); -+ peerpad = gst_pad_get_peer (GST_BASE_VIDEO_CODEC_SINK_PAD (enc)); -+ -+ switch GST_QUERY_TYPE -+ (query) { -+ case GST_QUERY_CONVERT: -+ { -+ GstFormat src_fmt, dest_fmt; -+ gint64 src_val, dest_val; -+ -+ gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); -+ res = -+ gst_base_video_encoded_video_convert (&enc->state, src_fmt, src_val, -+ &dest_fmt, &dest_val); -+ if (!res) -+ goto error; -+ gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); -+ break; -+ } -+ case GST_QUERY_LATENCY: -+ { -+ gboolean live; -+ GstClockTime min_latency, max_latency; -+ -+ res = gst_pad_query (peerpad, query); -+ if (res) { -+ gst_query_parse_latency (query, &live, &min_latency, &max_latency); -+ -+ min_latency += enc->min_latency; -+ if (max_latency != GST_CLOCK_TIME_NONE) { -+ max_latency += enc->max_latency; -+ } -+ -+ gst_query_set_latency (query, live, min_latency, max_latency); -+ } -+ } -+ break; -+ default: -+ res = gst_pad_query_default (pad, query); -+ } -+ gst_object_unref (peerpad); -+ gst_object_unref (enc); -+ return res; -+ -+error: -+ GST_DEBUG_OBJECT (enc, "query failed"); -+ gst_object_unref (peerpad); -+ gst_object_unref (enc); -+ return res; -+} -+ -+static gboolean -+gst_pad_is_negotiated (GstPad * pad) -+{ -+ GstCaps *caps; -+ -+ g_return_val_if_fail (pad != NULL, FALSE); -+ -+ caps = gst_pad_get_negotiated_caps (pad); -+ if (caps) { -+ gst_caps_unref (caps); -+ return TRUE; -+ } -+ -+ return FALSE; -+} -+ -+static GstFlowReturn -+gst_base_video_encoder_chain (GstPad * pad, GstBuffer * buf) -+{ -+ GstBaseVideoEncoder *base_video_encoder; -+ GstBaseVideoEncoderClass *klass; -+ GstVideoFrame *frame; -+ GstFlowReturn ret = GST_FLOW_OK; -+ -+ if (!gst_pad_is_negotiated (pad)) { -+ return GST_FLOW_NOT_NEGOTIATED; -+ } -+ -+ base_video_encoder = GST_BASE_VIDEO_ENCODER (gst_pad_get_parent (pad)); -+ klass = GST_BASE_VIDEO_ENCODER_GET_CLASS (base_video_encoder); -+ -+ if (base_video_encoder->sink_clipping) { -+ gint64 start = GST_BUFFER_TIMESTAMP (buf); -+ gint64 stop = start + GST_BUFFER_DURATION (buf); -+ gint64 clip_start; -+ gint64 clip_stop; -+ -+ if (!gst_segment_clip (&base_video_encoder->state.segment, -+ GST_FORMAT_TIME, start, stop, &clip_start, &clip_stop)) { -+ GST_DEBUG ("clipping to segment dropped frame"); -+ goto done; -+ } -+ } -+ -+ frame = g_malloc0 (sizeof (GstVideoFrame)); -+ frame->sink_buffer = buf; -+ frame->presentation_timestamp = GST_BUFFER_TIMESTAMP (buf); -+ frame->presentation_duration = GST_BUFFER_DURATION (buf); -+ frame->presentation_frame_number = -+ base_video_encoder->presentation_frame_number; -+ base_video_encoder->presentation_frame_number++; -+ -+ base_video_encoder->frames = -+ g_list_append (base_video_encoder->frames, frame); -+ -+ ret = klass->handle_frame (base_video_encoder, frame); -+ -+done: -+ g_object_unref (base_video_encoder); -+ -+ return ret; -+} -+ -+static GstStateChangeReturn -+gst_base_video_encoder_change_state (GstElement * element, -+ GstStateChange transition) -+{ -+ GstBaseVideoEncoder *base_video_encoder; -+ GstBaseVideoEncoderClass *base_video_encoder_class; -+ GstStateChangeReturn ret; -+ -+ base_video_encoder = GST_BASE_VIDEO_ENCODER (element); -+ base_video_encoder_class = GST_BASE_VIDEO_ENCODER_GET_CLASS (element); -+ -+ switch (transition) { -+ default: -+ break; -+ } -+ -+ ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); -+ -+ switch (transition) { -+ case GST_STATE_CHANGE_PAUSED_TO_READY: -+ if (base_video_encoder_class->stop) { -+ base_video_encoder_class->stop (base_video_encoder); -+ } -+ break; -+ default: -+ break; -+ } -+ -+ return ret; -+} -+ -+GstFlowReturn -+gst_base_video_encoder_finish_frame (GstBaseVideoEncoder * base_video_encoder, -+ GstVideoFrame * frame) -+{ -+ GstFlowReturn ret; -+ GstBaseVideoEncoderClass *base_video_encoder_class; -+ -+ base_video_encoder_class = -+ GST_BASE_VIDEO_ENCODER_GET_CLASS (base_video_encoder); -+ -+ frame->system_frame_number = base_video_encoder->system_frame_number; -+ base_video_encoder->system_frame_number++; -+ -+ if (frame->is_sync_point) { -+ base_video_encoder->distance_from_sync = 0; -+ GST_BUFFER_FLAG_UNSET (frame->src_buffer, GST_BUFFER_FLAG_DELTA_UNIT); -+ } else { -+ GST_BUFFER_FLAG_SET (frame->src_buffer, GST_BUFFER_FLAG_DELTA_UNIT); -+ } -+ -+ frame->distance_from_sync = base_video_encoder->distance_from_sync; -+ base_video_encoder->distance_from_sync++; -+ -+ frame->decode_frame_number = frame->system_frame_number - 1; -+ if (frame->decode_frame_number < 0) { -+ frame->decode_timestamp = 0; -+ } else { -+ frame->decode_timestamp = gst_util_uint64_scale (frame->decode_frame_number, -+ GST_SECOND * base_video_encoder->state.fps_d, -+ base_video_encoder->state.fps_n); -+ } -+ -+ GST_BUFFER_TIMESTAMP (frame->src_buffer) = frame->presentation_timestamp; -+ GST_BUFFER_DURATION (frame->src_buffer) = frame->presentation_duration; -+ GST_BUFFER_OFFSET (frame->src_buffer) = frame->decode_timestamp; -+ -+ base_video_encoder->frames = -+ g_list_remove (base_video_encoder->frames, frame); -+ -+ if (!base_video_encoder->set_output_caps) { -+ GstCaps *caps; -+ -+ if (base_video_encoder_class->get_caps) { -+ caps = base_video_encoder_class->get_caps (base_video_encoder); -+ } else { -+ caps = gst_caps_new_simple ("video/unknown", NULL); -+ } -+ base_video_encoder->caps = gst_caps_ref (caps); -+ gst_pad_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), caps); -+ base_video_encoder->set_output_caps = TRUE; -+ } -+ -+ if (base_video_encoder_class->shape_output) { -+ ret = base_video_encoder_class->shape_output (base_video_encoder, frame); -+ } else { -+ ret = -+ gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), -+ frame->src_buffer); -+ } -+ -+ gst_base_video_codec_free_frame (frame); -+ -+ return ret; -+} -+ -+int -+gst_base_video_encoder_get_height (GstBaseVideoEncoder * base_video_encoder) -+{ -+ return base_video_encoder->state.height; -+} -+ -+int -+gst_base_video_encoder_get_width (GstBaseVideoEncoder * base_video_encoder) -+{ -+ return base_video_encoder->state.width; -+} -+ -+const GstVideoState * -+gst_base_video_encoder_get_state (GstBaseVideoEncoder * base_video_encoder) -+{ -+ return &base_video_encoder->state; -+} -+ -+GstFlowReturn -+gst_base_video_encoder_end_of_stream (GstBaseVideoEncoder * base_video_encoder, -+ GstBuffer * buffer) -+{ -+ -+ if (base_video_encoder->frames) { -+ GST_WARNING ("EOS with frames left over"); -+ } -+ -+ return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), -+ buffer); -+} -+ -+void -+gst_base_video_encoder_set_latency (GstBaseVideoEncoder * base_video_encoder, -+ GstClockTime min_latency, GstClockTime max_latency) -+{ -+ g_return_if_fail (min_latency >= 0); -+ g_return_if_fail (max_latency >= min_latency); -+ -+ base_video_encoder->min_latency = min_latency; -+ base_video_encoder->max_latency = max_latency; -+} -+ -+void -+gst_base_video_encoder_set_latency_fields (GstBaseVideoEncoder * -+ base_video_encoder, int n_fields) -+{ -+ gint64 latency; -+ -+ latency = gst_util_uint64_scale (n_fields, -+ base_video_encoder->state.fps_d * GST_SECOND, -+ 2 * base_video_encoder->state.fps_n); -+ -+ gst_base_video_encoder_set_latency (base_video_encoder, latency, latency); -+ -+} -+ -+GstVideoFrame * -+gst_base_video_encoder_get_frame (GstBaseVideoEncoder * coder, int frame_number) -+{ -+ GList *g; -+ -+ for (g = coder->frames; g; g = g_list_next (g)) { -+ GstVideoFrame *frame = g->data; -+ -+ if (frame->system_frame_number == frame_number) { -+ return frame; -+ } -+ } -+ -+ return NULL; -+} -diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoencoder.h schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoencoder.h ---- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoencoder.h 1970-01-01 01:00:00.000000000 +0100 -+++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoencoder.h 2009-10-12 12:23:39.000000000 +0200 -@@ -0,0 +1,123 @@ -+/* GStreamer -+ * Copyright (C) 2008 David Schleef -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Library General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Library General Public License for more details. -+ * -+ * You should have received a copy of the GNU Library 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. -+ */ -+ -+#ifndef _GST_BASE_VIDEO_ENCODER_H_ -+#define _GST_BASE_VIDEO_ENCODER_H_ -+ -+#ifndef GST_USE_UNSTABLE_API -+#warning "GstBaseVideoEncoder is unstable API and may change in future." -+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning." -+#endif -+ -+#include -+#include -+ -+G_BEGIN_DECLS -+ -+#define GST_TYPE_BASE_VIDEO_ENCODER \ -+ (gst_base_video_encoder_get_type()) -+#define GST_BASE_VIDEO_ENCODER(obj) \ -+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_VIDEO_ENCODER,GstBaseVideoEncoder)) -+#define GST_BASE_VIDEO_ENCODER_CLASS(klass) \ -+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_VIDEO_ENCODER,GstBaseVideoEncoderClass)) -+#define GST_BASE_VIDEO_ENCODER_GET_CLASS(obj) \ -+ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_VIDEO_ENCODER,GstBaseVideoEncoderClass)) -+#define GST_IS_BASE_VIDEO_ENCODER(obj) \ -+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_VIDEO_ENCODER)) -+#define GST_IS_BASE_VIDEO_ENCODER_CLASS(obj) \ -+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_VIDEO_ENCODER)) -+ -+/** -+ * GST_BASE_VIDEO_ENCODER_SINK_NAME: -+ * -+ * The name of the templates for the sink pad. -+ */ -+#define GST_BASE_VIDEO_ENCODER_SINK_NAME "sink" -+/** -+ * GST_BASE_VIDEO_ENCODER_SRC_NAME: -+ * -+ * The name of the templates for the source pad. -+ */ -+#define GST_BASE_VIDEO_ENCODER_SRC_NAME "src" -+ -+ -+typedef struct _GstBaseVideoEncoder GstBaseVideoEncoder; -+typedef struct _GstBaseVideoEncoderClass GstBaseVideoEncoderClass; -+ -+struct _GstBaseVideoEncoder -+{ -+ GstBaseVideoCodec base_video_codec; -+ -+ /*< private >*/ -+ GList *frames; -+ -+ GstVideoState state; -+ -+ gboolean sink_clipping; -+ -+ guint64 presentation_frame_number; -+ guint64 system_frame_number; -+ int distance_from_sync; -+ -+ GstCaps *caps; -+ gboolean set_output_caps; -+ -+ gint64 min_latency; -+ gint64 max_latency; -+}; -+ -+struct _GstBaseVideoEncoderClass -+{ -+ GstBaseVideoCodecClass base_video_codec_class; -+ -+ gboolean (*set_format) (GstBaseVideoEncoder *coder, GstVideoState *state); -+ gboolean (*start) (GstBaseVideoEncoder *coder); -+ gboolean (*stop) (GstBaseVideoEncoder *coder); -+ gboolean (*finish) (GstBaseVideoEncoder *coder, GstVideoFrame *frame); -+ GstFlowReturn (*handle_frame) (GstBaseVideoEncoder *coder, GstVideoFrame *frame); -+ GstFlowReturn (*shape_output) (GstBaseVideoEncoder *coder, GstVideoFrame *frame); -+ GstCaps *(*get_caps) (GstBaseVideoEncoder *coder); -+ -+}; -+ -+GType gst_base_video_encoder_get_type (void); -+ -+int gst_base_video_encoder_get_width (GstBaseVideoEncoder *coder); -+int gst_base_video_encoder_get_height (GstBaseVideoEncoder *coder); -+const GstVideoState *gst_base_video_encoder_get_state (GstBaseVideoEncoder *coder); -+ -+guint64 gst_base_video_encoder_get_timestamp_offset (GstBaseVideoEncoder *coder); -+ -+GstVideoFrame *gst_base_video_encoder_get_frame (GstBaseVideoEncoder *coder, -+ int frame_number); -+GstFlowReturn gst_base_video_encoder_finish_frame (GstBaseVideoEncoder *base_video_encoder, -+ GstVideoFrame *frame); -+GstFlowReturn gst_base_video_encoder_end_of_stream (GstBaseVideoEncoder *base_video_encoder, -+ GstBuffer *buffer); -+ -+void gst_base_video_encoder_set_latency (GstBaseVideoEncoder *base_video_encoder, -+ GstClockTime min_latency, GstClockTime max_latency); -+void gst_base_video_encoder_set_latency_fields (GstBaseVideoEncoder *base_video_encoder, -+ int n_fields); -+ -+ -+G_END_DECLS -+ -+#endif -+ -diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoparse.c schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoparse.c ---- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoparse.c 1970-01-01 01:00:00.000000000 +0100 -+++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoparse.c 2009-10-12 12:23:39.000000000 +0200 -@@ -0,0 +1,871 @@ -+/* Schrodinger -+ * Copyright (C) 2006 David Schleef -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Library General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Library General Public License for more details. -+ * -+ * You should have received a copy of the GNU Library 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. -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+ -+#include "gstbasevideoparse.h" -+ -+#include -+#include -+ -+GST_DEBUG_CATEGORY_EXTERN (basevideo_debug); -+#define GST_CAT_DEFAULT basevideo_debug -+ -+ -+ -+/* GstBaseVideoParse signals and args */ -+enum -+{ -+ LAST_SIGNAL -+}; -+ -+enum -+{ -+ ARG_0 -+}; -+ -+static void gst_base_video_parse_finalize (GObject * object); -+ -+static const GstQueryType *gst_base_video_parse_get_query_types (GstPad * pad); -+static gboolean gst_base_video_parse_src_query (GstPad * pad, GstQuery * query); -+static gboolean gst_base_video_parse_sink_query (GstPad * pad, -+ GstQuery * query); -+static gboolean gst_base_video_parse_src_event (GstPad * pad, GstEvent * event); -+static gboolean gst_base_video_parse_sink_event (GstPad * pad, -+ GstEvent * event); -+static GstStateChangeReturn gst_base_video_parse_change_state (GstElement * -+ element, GstStateChange transition); -+static GstFlowReturn gst_base_video_parse_push_all (GstBaseVideoParse * -+ base_video_parse, gboolean at_eos); -+static GstFlowReturn gst_base_video_parse_chain (GstPad * pad, GstBuffer * buf); -+static void gst_base_video_parse_free_frame (GstVideoFrame * frame); -+static GstVideoFrame *gst_base_video_parse_new_frame (GstBaseVideoParse * -+ base_video_parse); -+ -+ -+GST_BOILERPLATE (GstBaseVideoParse, gst_base_video_parse, -+ GstBaseVideoCodec, GST_TYPE_BASE_VIDEO_CODEC); -+ -+static void -+gst_base_video_parse_base_init (gpointer g_class) -+{ -+ -+} -+ -+static void -+gst_base_video_parse_class_init (GstBaseVideoParseClass * klass) -+{ -+ GObjectClass *gobject_class; -+ GstElementClass *element_class; -+ -+ gobject_class = G_OBJECT_CLASS (klass); -+ element_class = GST_ELEMENT_CLASS (klass); -+ -+ gobject_class->finalize = gst_base_video_parse_finalize; -+ -+ element_class->change_state = gst_base_video_parse_change_state; -+} -+ -+static void -+gst_base_video_parse_init (GstBaseVideoParse * base_video_parse, -+ GstBaseVideoParseClass * klass) -+{ -+ GstPad *pad; -+ -+ GST_DEBUG ("gst_base_video_parse_init"); -+ -+ pad = GST_BASE_VIDEO_CODEC_SINK_PAD (base_video_parse); -+ -+ gst_pad_set_chain_function (pad, gst_base_video_parse_chain); -+ gst_pad_set_query_function (pad, gst_base_video_parse_sink_query); -+ gst_pad_set_event_function (pad, gst_base_video_parse_sink_event); -+ -+ pad = GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_parse); -+ -+ gst_pad_set_query_type_function (pad, gst_base_video_parse_get_query_types); -+ gst_pad_set_query_function (pad, gst_base_video_parse_src_query); -+ gst_pad_set_event_function (pad, gst_base_video_parse_src_event); -+ -+ base_video_parse->input_adapter = gst_adapter_new (); -+ base_video_parse->output_adapter = gst_adapter_new (); -+ -+ base_video_parse->reorder_depth = 1; -+ -+ base_video_parse->current_frame = -+ gst_base_video_parse_new_frame (base_video_parse); -+} -+ -+static void -+gst_base_video_parse_reset (GstBaseVideoParse * base_video_parse) -+{ -+ GST_DEBUG ("reset"); -+ -+ base_video_parse->discont = TRUE; -+ base_video_parse->have_sync = FALSE; -+ -+ base_video_parse->system_frame_number = 0; -+ base_video_parse->presentation_frame_number = 0; -+ -+ if (base_video_parse->caps) { -+ gst_caps_unref (base_video_parse->caps); -+ base_video_parse->caps = NULL; -+ } -+ -+ gst_segment_init (&base_video_parse->state.segment, GST_FORMAT_TIME); -+ gst_adapter_clear (base_video_parse->input_adapter); -+ gst_adapter_clear (base_video_parse->output_adapter); -+ -+ if (base_video_parse->current_frame) { -+ gst_base_video_parse_free_frame (base_video_parse->current_frame); -+ } -+ base_video_parse->current_frame = -+ gst_base_video_parse_new_frame (base_video_parse); -+ -+} -+ -+static void -+gst_base_video_parse_finalize (GObject * object) -+{ -+ GstBaseVideoParse *base_video_parse; -+ -+ g_return_if_fail (GST_IS_BASE_VIDEO_PARSE (object)); -+ base_video_parse = GST_BASE_VIDEO_PARSE (object); -+ -+ if (base_video_parse->input_adapter) { -+ g_object_unref (base_video_parse->input_adapter); -+ } -+ if (base_video_parse->output_adapter) { -+ g_object_unref (base_video_parse->output_adapter); -+ } -+ -+ G_OBJECT_CLASS (parent_class)->finalize (object); -+} -+ -+static const GstQueryType * -+gst_base_video_parse_get_query_types (GstPad * pad) -+{ -+ static const GstQueryType query_types[] = { -+ GST_QUERY_POSITION, -+ GST_QUERY_DURATION, -+ GST_QUERY_CONVERT, -+ 0 -+ }; -+ -+ return query_types; -+} -+ -+#if 0 -+static gboolean -+gst_base_video_parse_src_convert (GstPad * pad, -+ GstFormat src_format, gint64 src_value, -+ GstFormat * dest_format, gint64 * dest_value) -+{ -+ gboolean res; -+ GstBaseVideoParse *dec; -+ -+ if (src_format == *dest_format) { -+ *dest_value = src_value; -+ return TRUE; -+ } -+ -+ dec = GST_BASE_VIDEO_PARSE (gst_pad_get_parent (pad)); -+ -+ if (src_format == GST_FORMAT_DEFAULT && *dest_format == GST_FORMAT_TIME) { -+ if (dec->fps_d != 0) { -+ *dest_value = gst_util_uint64_scale (granulepos_to_frame (src_value), -+ dec->fps_d * GST_SECOND, dec->fps_n); -+ res = TRUE; -+ } else { -+ res = FALSE; -+ } -+ } else { -+ GST_WARNING ("unhandled conversion from %d to %d", src_format, -+ *dest_format); -+ res = FALSE; -+ } -+ -+ gst_object_unref (dec); -+ -+ return res; -+} -+ -+static gboolean -+gst_base_video_parse_sink_convert (GstPad * pad, -+ GstFormat src_format, gint64 src_value, -+ GstFormat * dest_format, gint64 * dest_value) -+{ -+ gboolean res = TRUE; -+ GstBaseVideoParse *dec; -+ -+ if (src_format == *dest_format) { -+ *dest_value = src_value; -+ return TRUE; -+ } -+ -+ dec = GST_BASE_VIDEO_PARSE (gst_pad_get_parent (pad)); -+ -+ /* FIXME: check if we are in a decoding state */ -+ -+ switch (src_format) { -+ case GST_FORMAT_DEFAULT: -+ switch (*dest_format) { -+ case GST_FORMAT_TIME: -+ *dest_value = gst_util_uint64_scale (src_value, -+ dec->fps_d * GST_SECOND, dec->fps_n); -+ break; -+ default: -+ res = FALSE; -+ } -+ break; -+ case GST_FORMAT_TIME: -+ switch (*dest_format) { -+ case GST_FORMAT_DEFAULT: -+ { -+ *dest_value = gst_util_uint64_scale (src_value, -+ dec->fps_n, dec->fps_d * GST_SECOND); -+ break; -+ } -+ default: -+ res = FALSE; -+ break; -+ } -+ break; -+ default: -+ res = FALSE; -+ break; -+ } -+ -+ gst_object_unref (dec); -+ -+ return res; -+} -+#endif -+ -+static gboolean -+gst_base_video_parse_src_query (GstPad * pad, GstQuery * query) -+{ -+ GstBaseVideoParse *base_parse; -+ gboolean res = FALSE; -+ -+ base_parse = GST_BASE_VIDEO_PARSE (gst_pad_get_parent (pad)); -+ -+ switch (GST_QUERY_TYPE (query)) { -+ case GST_QUERY_POSITION: -+ { -+ GstFormat format; -+ gint64 time; -+ gint64 value; -+ -+ gst_query_parse_position (query, &format, NULL); -+ -+ time = gst_util_uint64_scale (base_parse->presentation_frame_number, -+ base_parse->state.fps_n, base_parse->state.fps_d); -+ time += base_parse->state.segment.time; -+ GST_DEBUG ("query position %" G_GINT64_FORMAT, time); -+ res = gst_base_video_encoded_video_convert (&base_parse->state, -+ GST_FORMAT_TIME, time, &format, &value); -+ if (!res) -+ goto error; -+ -+ gst_query_set_position (query, format, value); -+ break; -+ } -+ case GST_QUERY_DURATION: -+ res = -+ gst_pad_query (GST_PAD_PEER (GST_BASE_VIDEO_CODEC_SINK_PAD -+ (base_parse)), query); -+ if (!res) -+ goto error; -+ break; -+ case GST_QUERY_CONVERT: -+ { -+ GstFormat src_fmt, dest_fmt; -+ gint64 src_val, dest_val; -+ -+ GST_WARNING ("query convert"); -+ -+ gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); -+ res = gst_base_video_encoded_video_convert (&base_parse->state, -+ src_fmt, src_val, &dest_fmt, &dest_val); -+ if (!res) -+ goto error; -+ gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); -+ break; -+ } -+ default: -+ res = gst_pad_query_default (pad, query); -+ break; -+ } -+done: -+ gst_object_unref (base_parse); -+ -+ return res; -+error: -+ GST_DEBUG_OBJECT (base_parse, "query failed"); -+ goto done; -+} -+ -+static gboolean -+gst_base_video_parse_sink_query (GstPad * pad, GstQuery * query) -+{ -+ GstBaseVideoParse *base_video_parse; -+ gboolean res = FALSE; -+ -+ base_video_parse = GST_BASE_VIDEO_PARSE (gst_pad_get_parent (pad)); -+ -+ switch (GST_QUERY_TYPE (query)) { -+ case GST_QUERY_CONVERT: -+ { -+ GstFormat src_fmt, dest_fmt; -+ gint64 src_val, dest_val; -+ -+ gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); -+ res = gst_base_video_encoded_video_convert (&base_video_parse->state, -+ src_fmt, src_val, &dest_fmt, &dest_val); -+ if (!res) -+ goto error; -+ gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); -+ break; -+ } -+ default: -+ res = gst_pad_query_default (pad, query); -+ break; -+ } -+done: -+ gst_object_unref (base_video_parse); -+ -+ return res; -+error: -+ GST_DEBUG_OBJECT (base_video_parse, "query failed"); -+ goto done; -+} -+ -+static gboolean -+gst_base_video_parse_src_event (GstPad * pad, GstEvent * event) -+{ -+ GstBaseVideoParse *base_video_parse; -+ gboolean res = FALSE; -+ -+ base_video_parse = GST_BASE_VIDEO_PARSE (gst_pad_get_parent (pad)); -+ -+ switch (GST_EVENT_TYPE (event)) { -+ case GST_EVENT_SEEK: -+ { -+ GstFormat format, tformat; -+ gdouble rate; -+ GstEvent *real_seek; -+ GstSeekFlags flags; -+ GstSeekType cur_type, stop_type; -+ gint64 cur, stop; -+ gint64 tcur, tstop; -+ -+ gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, -+ &cur, &stop_type, &stop); -+ gst_event_unref (event); -+ -+ tformat = GST_FORMAT_TIME; -+ res = gst_base_video_encoded_video_convert (&base_video_parse->state, -+ format, cur, &tformat, &tcur); -+ if (!res) -+ goto convert_error; -+ res = gst_base_video_encoded_video_convert (&base_video_parse->state, -+ format, stop, &tformat, &tstop); -+ if (!res) -+ goto convert_error; -+ -+ real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME, -+ flags, cur_type, tcur, stop_type, tstop); -+ -+ res = -+ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SINK_PAD (base_video_parse), -+ real_seek); -+ -+ break; -+ } -+#if 0 -+ case GST_EVENT_QOS: -+ { -+ gdouble proportion; -+ GstClockTimeDiff diff; -+ GstClockTime timestamp; -+ -+ gst_event_parse_qos (event, &proportion, &diff, ×tamp); -+ -+ GST_OBJECT_LOCK (base_video_parse); -+ base_video_parse->proportion = proportion; -+ base_video_parse->earliest_time = timestamp + diff; -+ GST_OBJECT_UNLOCK (base_video_parse); -+ -+ GST_DEBUG_OBJECT (base_video_parse, -+ "got QoS %" GST_TIME_FORMAT ", %" G_GINT64_FORMAT, -+ GST_TIME_ARGS (timestamp), diff); -+ -+ res = gst_pad_push_event (base_video_parse->sinkpad, event); -+ break; -+ } -+#endif -+ default: -+ res = -+ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SINK_PAD (base_video_parse), -+ event); -+ break; -+ } -+done: -+ gst_object_unref (base_video_parse); -+ return res; -+ -+convert_error: -+ GST_DEBUG_OBJECT (base_video_parse, "could not convert format"); -+ goto done; -+} -+ -+static gboolean -+gst_base_video_parse_sink_event (GstPad * pad, GstEvent * event) -+{ -+ GstBaseVideoParse *base_video_parse; -+ gboolean ret = FALSE; -+ -+ base_video_parse = GST_BASE_VIDEO_PARSE (gst_pad_get_parent (pad)); -+ -+ switch (GST_EVENT_TYPE (event)) { -+ case GST_EVENT_FLUSH_START: -+ ret = -+ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_parse), -+ event); -+ break; -+ case GST_EVENT_FLUSH_STOP: -+ gst_base_video_parse_reset (base_video_parse); -+ ret = -+ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_parse), -+ event); -+ break; -+ case GST_EVENT_EOS: -+ if (gst_base_video_parse_push_all (base_video_parse, -+ FALSE) == GST_FLOW_ERROR) { -+ gst_event_unref (event); -+ return FALSE; -+ } -+ -+ ret = -+ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_parse), -+ event); -+ break; -+ case GST_EVENT_NEWSEGMENT: -+ { -+ gboolean update; -+ GstFormat format; -+ gdouble rate; -+ gint64 start, stop, time; -+ -+ gst_event_parse_new_segment (event, &update, &rate, &format, &start, -+ &stop, &time); -+ -+ if (format != GST_FORMAT_TIME) -+ goto newseg_wrong_format; -+ -+ if (rate <= 0.0) -+ goto newseg_wrong_rate; -+ -+ GST_DEBUG ("newsegment %" G_GINT64_FORMAT " %" G_GINT64_FORMAT, start, -+ time); -+ gst_segment_set_newsegment (&base_video_parse->state.segment, update, -+ rate, format, start, stop, time); -+ -+ ret = -+ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_parse), -+ event); -+ break; -+ } -+ default: -+ ret = -+ gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_parse), -+ event); -+ break; -+ } -+done: -+ gst_object_unref (base_video_parse); -+ return ret; -+ -+newseg_wrong_format: -+ GST_DEBUG_OBJECT (base_video_parse, "received non TIME newsegment"); -+ gst_event_unref (event); -+ goto done; -+ -+newseg_wrong_rate: -+ GST_DEBUG_OBJECT (base_video_parse, "negative rates not supported"); -+ gst_event_unref (event); -+ goto done; -+} -+ -+ -+static GstStateChangeReturn -+gst_base_video_parse_change_state (GstElement * element, -+ GstStateChange transition) -+{ -+ GstBaseVideoParse *base_parse = GST_BASE_VIDEO_PARSE (element); -+ GstStateChangeReturn ret; -+ -+ switch (transition) { -+ case GST_STATE_CHANGE_NULL_TO_READY: -+ break; -+ case GST_STATE_CHANGE_READY_TO_PAUSED: -+ gst_base_video_parse_reset (base_parse); -+ break; -+ case GST_STATE_CHANGE_PAUSED_TO_PLAYING: -+ break; -+ default: -+ break; -+ } -+ -+ ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); -+ -+ switch (transition) { -+ case GST_STATE_CHANGE_PLAYING_TO_PAUSED: -+ break; -+ case GST_STATE_CHANGE_PAUSED_TO_READY: -+ gst_base_video_parse_reset (base_parse); -+ break; -+ case GST_STATE_CHANGE_READY_TO_NULL: -+ break; -+ default: -+ break; -+ } -+ -+ return ret; -+} -+ -+static guint64 -+gst_base_video_parse_get_timestamp (GstBaseVideoParse * base_video_parse, -+ int picture_number) -+{ -+ if (picture_number < 0) { -+ return base_video_parse->timestamp_offset - -+ (gint64) gst_util_uint64_scale (-picture_number, -+ base_video_parse->state.fps_d * GST_SECOND, -+ base_video_parse->state.fps_n); -+ } else { -+ return base_video_parse->timestamp_offset + -+ gst_util_uint64_scale (picture_number, -+ base_video_parse->state.fps_d * GST_SECOND, -+ base_video_parse->state.fps_n); -+ } -+} -+ -+static GstFlowReturn -+gst_base_video_parse_push_all (GstBaseVideoParse * base_video_parse, -+ gboolean at_eos) -+{ -+ GstFlowReturn ret = GST_FLOW_OK; -+ -+ /* FIXME do stuff */ -+ -+ return ret; -+} -+ -+static GstBuffer * -+gst_adapter_get_buffer (GstAdapter * adapter) -+{ -+ return gst_buffer_ref (GST_BUFFER (adapter->buflist->data)); -+ -+} -+ -+static GstFlowReturn -+gst_base_video_parse_chain (GstPad * pad, GstBuffer * buf) -+{ -+ GstBaseVideoParse *base_video_parse; -+ GstBaseVideoParseClass *klass; -+ GstBuffer *buffer; -+ GstFlowReturn ret; -+ -+ GST_DEBUG ("chain with %d bytes", GST_BUFFER_SIZE (buf)); -+ -+ base_video_parse = GST_BASE_VIDEO_PARSE (GST_PAD_PARENT (pad)); -+ klass = GST_BASE_VIDEO_PARSE_GET_CLASS (base_video_parse); -+ -+ if (!base_video_parse->started) { -+ klass->start (base_video_parse); -+ base_video_parse->started = TRUE; -+ } -+ -+ if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DISCONT))) { -+ GST_DEBUG_OBJECT (base_video_parse, "received DISCONT buffer"); -+ gst_base_video_parse_reset (base_video_parse); -+ base_video_parse->discont = TRUE; -+ base_video_parse->have_sync = FALSE; -+ } -+ -+ if (GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) { -+ base_video_parse->last_timestamp = GST_BUFFER_TIMESTAMP (buf); -+ } -+ gst_adapter_push (base_video_parse->input_adapter, buf); -+ -+ if (!base_video_parse->have_sync) { -+ int n, m; -+ -+ GST_DEBUG ("no sync, scanning"); -+ -+ n = gst_adapter_available (base_video_parse->input_adapter); -+ m = klass->scan_for_sync (base_video_parse->input_adapter, FALSE, 0, n); -+ -+ gst_adapter_flush (base_video_parse->input_adapter, m); -+ -+ if (m < n) { -+ GST_DEBUG ("found possible sync after %d bytes (of %d)", m, n); -+ -+ /* this is only "maybe" sync */ -+ base_video_parse->have_sync = TRUE; -+ } -+ -+ if (!base_video_parse->have_sync) { -+ return GST_FLOW_OK; -+ } -+ } -+ -+ /* FIXME: use gst_adapter_prev_timestamp() here instead? */ -+ buffer = gst_adapter_get_buffer (base_video_parse->input_adapter); -+ -+ gst_buffer_unref (buffer); -+ -+ /* FIXME check klass->parse_data */ -+ -+ do { -+ ret = klass->parse_data (base_video_parse, FALSE); -+ } while (ret == GST_FLOW_OK); -+ -+ if (ret == GST_BASE_VIDEO_PARSE_FLOW_NEED_DATA) { -+ return GST_FLOW_OK; -+ } -+ return ret; -+} -+ -+GstVideoState * -+gst_base_video_parse_get_state (GstBaseVideoParse * base_video_parse) -+{ -+ return &base_video_parse->state; -+} -+ -+void -+gst_base_video_parse_set_state (GstBaseVideoParse * base_video_parse, -+ GstVideoState * state) -+{ -+ GST_DEBUG ("set_state"); -+ -+ memcpy (&base_video_parse->state, state, sizeof (GstVideoState)); -+ -+ /* FIXME set caps */ -+ -+} -+ -+ -+gboolean -+gst_base_video_parse_set_src_caps (GstBaseVideoParse * base_video_parse, -+ GstCaps * caps) -+{ -+ g_return_val_if_fail (GST_IS_BASE_VIDEO_PARSE (base_video_parse), FALSE); -+ -+ GST_DEBUG ("set_src_caps"); -+ -+ return gst_pad_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_parse), -+ caps); -+} -+ -+void -+gst_base_video_parse_lost_sync (GstBaseVideoParse * base_video_parse) -+{ -+ g_return_if_fail (GST_IS_BASE_VIDEO_PARSE (base_video_parse)); -+ -+ GST_DEBUG ("lost_sync"); -+ -+ if (gst_adapter_available (base_video_parse->input_adapter) >= 1) { -+ gst_adapter_flush (base_video_parse->input_adapter, 1); -+ } -+ -+ base_video_parse->have_sync = FALSE; -+} -+ -+GstVideoFrame * -+gst_base_video_parse_get_frame (GstBaseVideoParse * base_video_parse) -+{ -+ g_return_val_if_fail (GST_IS_BASE_VIDEO_PARSE (base_video_parse), NULL); -+ -+ return base_video_parse->current_frame; -+} -+ -+void -+gst_base_video_parse_add_to_frame (GstBaseVideoParse * base_video_parse, -+ int n_bytes) -+{ -+ GstBuffer *buf; -+ -+ GST_DEBUG ("add_to_frame"); -+ -+ buf = gst_adapter_take_buffer (base_video_parse->input_adapter, n_bytes); -+ -+ gst_adapter_push (base_video_parse->output_adapter, buf); -+} -+ -+GstFlowReturn -+gst_base_video_parse_finish_frame (GstBaseVideoParse * base_video_parse) -+{ -+ GstVideoFrame *frame = base_video_parse->current_frame; -+ GstBuffer *buffer; -+ GstBaseVideoParseClass *base_video_parse_class; -+ GstFlowReturn ret; -+ -+ GST_DEBUG ("finish_frame"); -+ -+ base_video_parse_class = GST_BASE_VIDEO_PARSE_GET_CLASS (base_video_parse); -+ -+ buffer = gst_adapter_take_buffer (base_video_parse->output_adapter, -+ gst_adapter_available (base_video_parse->output_adapter)); -+ -+ if (frame->is_sync_point) { -+ base_video_parse->timestamp_offset = base_video_parse->last_timestamp - -+ gst_util_uint64_scale (frame->presentation_frame_number, -+ base_video_parse->state.fps_d * GST_SECOND, -+ base_video_parse->state.fps_n); -+ base_video_parse->distance_from_sync = 0; -+ } -+ -+ frame->distance_from_sync = base_video_parse->distance_from_sync; -+ base_video_parse->distance_from_sync++; -+ -+ frame->presentation_timestamp = -+ gst_base_video_parse_get_timestamp (base_video_parse, -+ frame->presentation_frame_number); -+ frame->presentation_duration = -+ gst_base_video_parse_get_timestamp (base_video_parse, -+ frame->presentation_frame_number + 1) - frame->presentation_timestamp; -+ frame->decode_timestamp = -+ gst_base_video_parse_get_timestamp (base_video_parse, -+ frame->decode_frame_number); -+ -+ GST_BUFFER_TIMESTAMP (buffer) = frame->presentation_timestamp; -+ GST_BUFFER_DURATION (buffer) = frame->presentation_duration; -+ if (frame->decode_frame_number < 0) { -+ GST_BUFFER_OFFSET (buffer) = 0; -+ } else { -+ GST_BUFFER_OFFSET (buffer) = frame->decode_timestamp; -+ } -+ GST_BUFFER_OFFSET_END (buffer) = GST_CLOCK_TIME_NONE; -+ -+ GST_DEBUG ("pts %" GST_TIME_FORMAT, -+ GST_TIME_ARGS (frame->presentation_timestamp)); -+ GST_DEBUG ("dts %" GST_TIME_FORMAT, GST_TIME_ARGS (frame->decode_timestamp)); -+ GST_DEBUG ("dist %d", frame->distance_from_sync); -+ -+ if (frame->is_sync_point) { -+ GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DELTA_UNIT); -+ } else { -+ GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT); -+ } -+ -+ frame->src_buffer = buffer; -+ ret = base_video_parse_class->shape_output (base_video_parse, frame); -+ -+ gst_base_video_parse_free_frame (base_video_parse->current_frame); -+ -+ /* create new frame */ -+ base_video_parse->current_frame = -+ gst_base_video_parse_new_frame (base_video_parse); -+ -+ return ret; -+} -+ -+static void -+gst_base_video_parse_free_frame (GstVideoFrame * frame) -+{ -+ if (frame->sink_buffer) { -+ gst_buffer_unref (frame->sink_buffer); -+ } -+#if 0 -+ if (frame->src_buffer) { -+ gst_buffer_unref (frame->src_buffer); -+ } -+#endif -+ -+ g_free (frame); -+} -+ -+static GstVideoFrame * -+gst_base_video_parse_new_frame (GstBaseVideoParse * base_video_parse) -+{ -+ GstVideoFrame *frame; -+ -+ frame = g_malloc0 (sizeof (GstVideoFrame)); -+ -+ frame->system_frame_number = base_video_parse->system_frame_number; -+ base_video_parse->system_frame_number++; -+ -+ frame->decode_frame_number = frame->system_frame_number - -+ base_video_parse->reorder_depth; -+ -+ return frame; -+} -+ -+void -+gst_base_video_parse_set_sync_point (GstBaseVideoParse * base_video_parse) -+{ -+ GST_DEBUG ("set_sync_point"); -+ -+ base_video_parse->current_frame->is_sync_point = TRUE; -+ -+ base_video_parse->distance_from_sync = 0; -+} -+ -+GstFlowReturn -+gst_base_video_parse_push (GstBaseVideoParse * base_video_parse, -+ GstBuffer * buffer) -+{ -+ GstBaseVideoParseClass *base_video_parse_class; -+ -+ base_video_parse_class = GST_BASE_VIDEO_PARSE_GET_CLASS (base_video_parse); -+ -+ if (base_video_parse->caps == NULL) { -+ gboolean ret; -+ -+ base_video_parse->caps = -+ base_video_parse_class->get_caps (base_video_parse); -+ -+ ret = gst_pad_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_parse), -+ base_video_parse->caps); -+ -+ if (!ret) { -+ GST_WARNING ("pad didn't accept caps"); -+ return GST_FLOW_ERROR; -+ } -+ } -+ gst_buffer_set_caps (buffer, base_video_parse->caps); -+ -+ GST_DEBUG ("pushing ts=%" G_GINT64_FORMAT " dur=%" G_GINT64_FORMAT " off=%" -+ G_GINT64_FORMAT " off_end=%" G_GINT64_FORMAT, -+ GST_BUFFER_TIMESTAMP (buffer), GST_BUFFER_DURATION (buffer), -+ GST_BUFFER_OFFSET (buffer), GST_BUFFER_OFFSET_END (buffer)); -+ -+ if (base_video_parse->discont) { -+ GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT); -+ base_video_parse->discont = FALSE; -+ } else { -+ GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DISCONT); -+ } -+ -+ return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_parse), buffer); -+} -diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoparse.h schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoparse.h ---- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoparse.h 1970-01-01 01:00:00.000000000 +0100 -+++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoparse.h 2009-09-11 17:35:39.000000000 +0200 -@@ -0,0 +1,141 @@ -+/* GStreamer -+ * Copyright (C) 2008 David Schleef -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Library General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Library General Public License for more details. -+ * -+ * You should have received a copy of the GNU Library 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. -+ */ -+ -+#ifndef _GST_BASE_VIDEO_PARSE_H_ -+#define _GST_BASE_VIDEO_PARSE_H_ -+ -+#ifndef GST_USE_UNSTABLE_API -+#warning "GstBaseVideoParse is unstable API and may change in future." -+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning." -+#endif -+ -+#include -+#include -+ -+G_BEGIN_DECLS -+ -+#define GST_TYPE_BASE_VIDEO_PARSE \ -+ (gst_base_video_parse_get_type()) -+#define GST_BASE_VIDEO_PARSE(obj) \ -+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_VIDEO_PARSE,GstBaseVideoParse)) -+#define GST_BASE_VIDEO_PARSE_CLASS(klass) \ -+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_VIDEO_PARSE,GstBaseVideoParseClass)) -+#define GST_BASE_VIDEO_PARSE_GET_CLASS(obj) \ -+ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_VIDEO_PARSE,GstBaseVideoParseClass)) -+#define GST_IS_BASE_VIDEO_PARSE(obj) \ -+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_VIDEO_PARSE)) -+#define GST_IS_BASE_VIDEO_PARSE_CLASS(obj) \ -+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_VIDEO_PARSE)) -+ -+/** -+ * GST_BASE_VIDEO_PARSE_SINK_NAME: -+ * -+ * The name of the templates for the sink pad. -+ */ -+#define GST_BASE_VIDEO_PARSE_SINK_NAME "sink" -+/** -+ * GST_BASE_VIDEO_PARSE_SRC_NAME: -+ * -+ * The name of the templates for the source pad. -+ */ -+#define GST_BASE_VIDEO_PARSE_SRC_NAME "src" -+ -+/** -+ * GST_BASE_VIDEO_PARSE_FLOW_NEED_DATA: -+ * -+ */ -+#define GST_BASE_VIDEO_PARSE_FLOW_NEED_DATA GST_FLOW_CUSTOM_SUCCESS -+ -+typedef struct _GstBaseVideoParse GstBaseVideoParse; -+typedef struct _GstBaseVideoParseClass GstBaseVideoParseClass; -+ -+struct _GstBaseVideoParse -+{ -+ GstBaseVideoCodec base_video_codec; -+ -+ /*< private >*/ -+ GstAdapter *input_adapter; -+ GstAdapter *output_adapter; -+ -+ int reorder_depth; -+ -+ gboolean have_sync; -+ gboolean discont; -+ gboolean started; -+ -+ GstVideoFrame *current_frame; -+ GstVideoState state; -+ int distance_from_sync; -+ -+ gboolean sink_clipping; -+ -+ guint64 presentation_frame_number; -+ guint64 system_frame_number; -+ -+ GstCaps *caps; -+ gboolean set_output_caps; -+ -+ GstClockTime last_timestamp; -+ -+ gint64 timestamp_offset; -+}; -+ -+struct _GstBaseVideoParseClass -+{ -+ GstBaseVideoCodecClass base_video_codec_class; -+ -+ gboolean (*start) (GstBaseVideoParse *parse); -+ gboolean (*stop) (GstBaseVideoParse *parse); -+ gboolean (*reset) (GstBaseVideoParse *parse); -+ GstFlowReturn (*parse_data) (GstBaseVideoParse *parse, gboolean at_eos); -+ int (*scan_for_sync) (GstAdapter *adapter, gboolean at_eos, -+ int offset, int n); -+ GstFlowReturn (*shape_output) (GstBaseVideoParse *parse, GstVideoFrame *frame); -+ GstCaps *(*get_caps) (GstBaseVideoParse *parse); -+ -+}; -+ -+GType gst_base_video_parse_get_type (void); -+ -+int gst_base_video_parse_get_width (GstBaseVideoParse *parse); -+int gst_base_video_parse_get_height (GstBaseVideoParse *parse); -+GstVideoState *gst_base_video_parse_get_state (GstBaseVideoParse *parse); -+void gst_base_video_parse_set_state (GstBaseVideoParse *parse, -+ GstVideoState *state); -+ -+guint64 gst_base_video_parse_get_timestamp_offset (GstBaseVideoParse *parse); -+ -+gboolean gst_base_video_parse_set_src_caps (GstBaseVideoParse *base_video_parse, GstCaps *caps); -+ -+GstFlowReturn gst_base_video_parse_end_of_stream (GstBaseVideoParse *base_video_parse, -+ GstBuffer *buffer); -+ -+void gst_base_video_parse_lost_sync (GstBaseVideoParse *base_video_parse); -+ -+GstVideoFrame * gst_base_video_parse_get_frame (GstBaseVideoParse *base_video_parse); -+void gst_base_video_parse_add_to_frame (GstBaseVideoParse *base_video_parse, int n_bytes); -+GstFlowReturn gst_base_video_parse_finish_frame (GstBaseVideoParse *base_video_parse); -+void gst_base_video_parse_set_sync_point (GstBaseVideoParse *base_video_parse); -+GstFlowReturn gst_base_video_parse_push (GstBaseVideoParse *base_video_parse, -+ GstBuffer *buffer); -+ -+G_END_DECLS -+ -+#endif -+ -diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoutils.c schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoutils.c ---- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoutils.c 1970-01-01 01:00:00.000000000 +0100 -+++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoutils.c 2009-10-12 12:23:39.000000000 +0200 -@@ -0,0 +1,163 @@ -+/* GStreamer -+ * Copyright (C) 2008 David Schleef -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Library General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Library General Public License for more details. -+ * -+ * You should have received a copy of the GNU Library 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. -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+ -+#include "gstbasevideoutils.h" -+ -+#include -+ -+GST_DEBUG_CATEGORY_EXTERN (basevideo_debug); -+#define GST_CAT_DEFAULT basevideo_debug -+ -+ -+guint64 -+gst_base_video_convert_bytes_to_frames (GstVideoState * state, guint64 bytes) -+{ -+ return gst_util_uint64_scale_int (bytes, 1, state->bytes_per_picture); -+} -+ -+guint64 -+gst_base_video_convert_frames_to_bytes (GstVideoState * state, guint64 frames) -+{ -+ return frames * state->bytes_per_picture; -+} -+ -+ -+gboolean -+gst_base_video_rawvideo_convert (GstVideoState * state, -+ GstFormat src_format, gint64 src_value, -+ GstFormat * dest_format, gint64 * dest_value) -+{ -+ gboolean res = FALSE; -+ -+ if (src_format == *dest_format) { -+ *dest_value = src_value; -+ return TRUE; -+ } -+ -+ if (src_format == GST_FORMAT_BYTES && -+ *dest_format == GST_FORMAT_DEFAULT && state->bytes_per_picture != 0) { -+ /* convert bytes to frames */ -+ *dest_value = gst_util_uint64_scale_int (src_value, 1, -+ state->bytes_per_picture); -+ res = TRUE; -+ } else if (src_format == GST_FORMAT_DEFAULT && -+ *dest_format == GST_FORMAT_BYTES && state->bytes_per_picture != 0) { -+ /* convert bytes to frames */ -+ *dest_value = src_value * state->bytes_per_picture; -+ res = TRUE; -+ } else if (src_format == GST_FORMAT_DEFAULT && -+ *dest_format == GST_FORMAT_TIME && state->fps_n != 0) { -+ /* convert frames to time */ -+ /* FIXME add segment time? */ -+ *dest_value = gst_util_uint64_scale (src_value, -+ GST_SECOND * state->fps_d, state->fps_n); -+ res = TRUE; -+ } else if (src_format == GST_FORMAT_TIME && -+ *dest_format == GST_FORMAT_DEFAULT && state->fps_d != 0) { -+ /* convert time to frames */ -+ /* FIXME subtract segment time? */ -+ *dest_value = gst_util_uint64_scale (src_value, state->fps_n, -+ GST_SECOND * state->fps_d); -+ res = TRUE; -+ } -+ -+ /* FIXME add bytes <--> time */ -+ -+ return res; -+} -+ -+gboolean -+gst_base_video_encoded_video_convert (GstVideoState * state, -+ GstFormat src_format, gint64 src_value, -+ GstFormat * dest_format, gint64 * dest_value) -+{ -+ gboolean res = FALSE; -+ -+ if (src_format == *dest_format) { -+ *dest_value = src_value; -+ return TRUE; -+ } -+ -+ GST_DEBUG ("src convert"); -+ -+#if 0 -+ if (src_format == GST_FORMAT_DEFAULT && *dest_format == GST_FORMAT_TIME) { -+ if (dec->fps_d != 0) { -+ *dest_value = gst_util_uint64_scale (granulepos_to_frame (src_value), -+ dec->fps_d * GST_SECOND, dec->fps_n); -+ res = TRUE; -+ } else { -+ res = FALSE; -+ } -+ } else { -+ GST_WARNING ("unhandled conversion from %d to %d", src_format, -+ *dest_format); -+ res = FALSE; -+ } -+#endif -+ -+ return res; -+} -+ -+gboolean -+gst_base_video_state_from_caps (GstVideoState * state, GstCaps * caps) -+{ -+ -+ gst_video_format_parse_caps (caps, &state->format, -+ &state->width, &state->height); -+ -+ if (!gst_video_parse_caps_framerate (caps, &state->fps_n, &state->fps_d)) -+ return FALSE; -+ -+ state->par_n = 1; -+ state->par_d = 1; -+ gst_video_parse_caps_pixel_aspect_ratio (caps, &state->par_n, &state->par_d); -+ -+ { -+ GstStructure *structure = gst_caps_get_structure (caps, 0); -+ state->interlaced = FALSE; -+ gst_structure_get_boolean (structure, "interlaced", &state->interlaced); -+ } -+ -+ state->clean_width = state->width; -+ state->clean_height = state->height; -+ state->clean_offset_left = 0; -+ state->clean_offset_top = 0; -+ -+ /* FIXME need better error handling */ -+ return TRUE; -+} -+ -+GstClockTime -+gst_video_state_get_timestamp (const GstVideoState * state, int frame_number) -+{ -+ if (frame_number < 0) { -+ return state->segment.start - -+ (gint64) gst_util_uint64_scale (-frame_number, -+ state->fps_d * GST_SECOND, state->fps_n); -+ } else { -+ return state->segment.start + -+ gst_util_uint64_scale (frame_number, -+ state->fps_d * GST_SECOND, state->fps_n); -+ } -+} -diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoutils.h schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoutils.h ---- schroedinger-1.0.8.orig/gst-libs/gst/video/gstbasevideoutils.h 1970-01-01 01:00:00.000000000 +0100 -+++ schroedinger-1.0.8/gst-libs/gst/video/gstbasevideoutils.h 2009-09-11 17:35:39.000000000 +0200 -@@ -0,0 +1,95 @@ -+/* GStreamer -+ * Copyright (C) 2008 David Schleef -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Library General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Library General Public License for more details. -+ * -+ * You should have received a copy of the GNU Library 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. -+ */ -+ -+#ifndef _GST_BASE_VIDEO_UTILS_H_ -+#define _GST_BASE_VIDEO_UTILS_H_ -+ -+#ifndef GST_USE_UNSTABLE_API -+#warning "The base video utils API is unstable and may change in future." -+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning." -+#endif -+ -+#include -+#include -+#include -+ -+G_BEGIN_DECLS -+ -+typedef struct _GstVideoState GstVideoState; -+typedef struct _GstVideoFrame GstVideoFrame; -+ -+struct _GstVideoState -+{ -+ GstVideoFormat format; -+ int width, height; -+ int fps_n, fps_d; -+ int par_n, par_d; -+ gboolean interlaced; -+ gboolean top_field_first; -+ -+ int clean_width, clean_height; -+ int clean_offset_left, clean_offset_top; -+ -+ int bytes_per_picture; -+ -+ GstSegment segment; -+ -+ int picture_number; -+}; -+ -+struct _GstVideoFrame -+{ -+ guint64 decode_timestamp; -+ guint64 presentation_timestamp; -+ guint64 presentation_duration; -+ -+ gint system_frame_number; -+ gint decode_frame_number; -+ gint presentation_frame_number; -+ -+ int distance_from_sync; -+ gboolean is_sync_point; -+ gboolean is_eos; -+ -+ GstBuffer *sink_buffer; -+ GstBuffer *src_buffer; -+ -+ int field_index; -+ int n_fields; -+ -+ void *coder_hook; -+}; -+ -+gboolean gst_base_video_rawvideo_convert (GstVideoState *state, -+ GstFormat src_format, gint64 src_value, -+ GstFormat * dest_format, gint64 *dest_value); -+gboolean gst_base_video_encoded_video_convert (GstVideoState *state, -+ GstFormat src_format, gint64 src_value, -+ GstFormat * dest_format, gint64 *dest_value); -+ -+gboolean gst_base_video_state_from_caps (GstVideoState *state, -+ GstCaps *caps); -+ -+GstClockTime gst_video_state_get_timestamp (const GstVideoState *state, -+ int frame_number); -+ -+G_END_DECLS -+ -+#endif -+ -diff -uNr schroedinger-1.0.8.orig/gst-libs/gst/video/Makefile.am schroedinger-1.0.8/gst-libs/gst/video/Makefile.am ---- schroedinger-1.0.8.orig/gst-libs/gst/video/Makefile.am 1970-01-01 01:00:00.000000000 +0100 -+++ schroedinger-1.0.8/gst-libs/gst/video/Makefile.am 2009-09-11 17:35:39.000000000 +0200 -@@ -0,0 +1,24 @@ -+ -+lib_LTLIBRARIES = libgstbasevideo-@GST_MAJORMINOR@.la -+ -+CLEANFILES = $(BUILT_SOURCES) -+ -+libgstbasevideo_@GST_MAJORMINOR@_la_SOURCES = \ -+ gstbasevideoutils.c \ -+ gstbasevideocodec.c \ -+ gstbasevideodecoder.c \ -+ gstbasevideoencoder.c \ -+ gstbasevideoparse.c -+ -+libgstbasevideo_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/video -+libgstbasevideo_@GST_MAJORMINOR@include_HEADERS = \ -+ gstbasevideoutils.h \ -+ gstbasevideocodec.h \ -+ gstbasevideodecoder.h \ -+ gstbasevideoencoder.h \ -+ gstbasevideoparse.h -+ -+libgstbasevideo_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) -DGST_USE_UNSTABLE_API -I$(top_srcdir)/gst-libs -+libgstbasevideo_@GST_MAJORMINOR@_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) -lgstvideo-@GST_MAJORMINOR@ -+libgstbasevideo_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) -static -+ diff --git a/gst-plugins-schroedinger-plug.patch b/gst-plugins-schroedinger-plug.patch deleted file mode 100644 index 12370dd..0000000 --- a/gst-plugins-schroedinger-plug.patch +++ /dev/null @@ -1,74 +0,0 @@ ---- schroedinger-1.0.8.orig/configure.ac 2009-09-29 07:23:37.000000000 +0200 -+++ schroedinger-1.0.8/configure.ac 2009-04-23 05:20:57.000000000 +0200 -@@ -150,6 +150,47 @@ - SCHRO_CFLAGS="$SCHRO_CFLAGS -I\$(top_srcdir)" - AC_SUBST(SCHRO_CFLAGS) - -+######################## -+# GStreamer stuff -+######################## -+ -+GST_MAJORMINOR=0.10 -+AC_SUBST(GST_MAJORMINOR) -+dnl *** check for arguments to configure *** -+ -+if test "x$with_opengl" = xyes; then -+ GST_GL_DEP="gst-plugins-gl-0.10" -+fi -+ -+AC_ARG_ENABLE(gstreamer, AC_HELP_STRING([--disable-gstreamer], -+ [disable gstreamer support (default=enabled)])) -+if test "x$enable_gstreamer" != xno -+then -+ PKG_CHECK_MODULES(GST, gstreamer-0.10 >= 0.10.19 gstreamer-base-0.10 >= 0.10.19 gstreamer-video-0.10 >= 0.10.19 ${GST_GL_DEP}, -+ HAVE_GST=yes, HAVE_GST=no) -+else -+ HAVE_GST=no -+fi -+ -+AM_CONDITIONAL(HAVE_GST, test "x$HAVE_GST" = "xyes") -+AC_SUBST(GST_CFLAGS) -+AC_SUBST(GST_LIBS) -+ -+plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR" -+AC_SUBST(plugindir) -+ -+GST_ALL_LDFLAGS="-no-undefined" -+AC_SUBST(GST_ALL_LDFLAGS) -+ -+GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^[_]*gst_plugin_desc\$\$' $GST_ALL_LDFLAGS" -+AC_SUBST(GST_PLUGIN_LDFLAGS) -+ -+AC_DEFINE(GST_PACKAGE_ORIGIN, "unknown", [Package origin in GStreamer plugin]) -+ -+AC_ARG_ENABLE(video-compat, AC_HELP_STRING([--disable-video-compat], -+ [disable gstvideo compatibility (default=enabled)])) -+AM_CONDITIONAL(ENABLE_VIDEO_COMPAT, test "x$enable_video_compat" != "xno") -+ - - ######################## - # Check for CUDA -@@ -238,6 +279,8 @@ - schroedinger/Makefile - schroedinger/cuda/Makefile - schroedinger/opengl/Makefile -+gst-libs/gst/video/Makefile -+gst/Makefile - testsuite/Makefile - testsuite/cache/Makefile - testsuite/cuda/Makefile ---- schroedinger-1.0.8.orig/Makefile.am 2009-09-29 07:08:51.000000000 +0200 -+++ schroedinger-1.0.8/Makefile.am 2009-04-22 04:35:57.000000000 +0200 -@@ -4,7 +4,11 @@ - - DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc - --DIST_SUBDIRS = schroedinger doc tools testsuite -+if HAVE_GST -+SUBDIRS += gst-libs/gst/video gst -+endif -+ -+DIST_SUBDIRS = schroedinger doc tools gst testsuite gst-libs/gst/video - - EXTRA_DIST = COPYING COPYING.GPL COPYING.LGPL COPYING.MIT COPYING.MPL \ - autogen.sh schroedinger.spec TODO NEWS diff --git a/schroedinger.spec b/schroedinger.spec index 779925e..cec04dd 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.8 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -10,17 +10,11 @@ Group: System Environment/Libraries License: GPL+ or LGPLv2+ or MIT or MPLv1.1 URL: http://www.diracvideo.org/ Source0: http://www.diracvideo.org/download/schroedinger/schroedinger-%{version}.tar.gz -Patch0: gst-plugins-schroedinger-1.0.8.patch -Patch1: gst-plugins-schroedinger-plug.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: libtool - BuildRequires: liboil-devel >= 0.3.16 BuildRequires: glew-devel >= 1.5.1 -BuildRequires: gstreamer-devel >= 0.10 -BuildRequires: gstreamer-plugins-base-devel >= 0.10 -BuildRequires: gtk-doc + %description The Schrödinger project will implement portable libraries for the high @@ -42,27 +36,14 @@ Requires: liboil-devel >= 0.3.16 %description devel Development files for schroedinger -%package -n gstreamer-plugins-schroedinger -Group: Applications/Multimedia -Summary: GStreamer Plugins that implement Dirac video encoding and decoding - -%description -n gstreamer-plugins-schroedinger -GStreamer Plugins that implement Dirac video encoding and decoding %prep %setup -q -%patch0 -p1 -%patch1 -p1 -b .plug - -autoreconf -vif %build %configure --disable-static --enable-gtk-doc -# hack to define the package name -echo "#define GST_PACKAGE_NAME \"gst-plugins-schroedinger fedora rpm\"" >> config.h - # remove rpath from libtool sed -i.rpath 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i.rpath 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool @@ -93,13 +74,12 @@ rm -rf %{buildroot} %{_libdir}/*.so %{_libdir}/pkgconfig/schroedinger-%{abi}.pc -%files -n gstreamer-plugins-schroedinger -%defattr(-,root,root,-) -%{_libdir}/gstreamer-0.10/libgstschro.so -%exclude %{_libdir}/libgstbasevideo-0.10.a -%exclude %{_includedir}/gstreamer-0.10 %changelog +* Mon Feb 1 2010 Nicolas CHauvet - 1.0.8-4 +- Remove gstreamer-plugins-schroedinger + Obsoleted by gst-plugins-bad-free introduction in Fedora. + * Sun Oct 25 2009 kwizart < kwizart at gmail.com > - 1.0.8-3 - Re-introduce gstreamer sub-package until seen in -good From 4f91d64600032b2d53041747e7475da5f3eacdc3 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Wed, 17 Feb 2010 03:08:51 +0000 Subject: [PATCH 23/57] Initialize branch F-13 for schroedinger --- branch | 1 + 1 file changed, 1 insertion(+) create mode 100644 branch diff --git a/branch b/branch new file mode 100644 index 0000000..baa94ef --- /dev/null +++ b/branch @@ -0,0 +1 @@ +F-13 From 77760f9121193c8341b43127740f9d957aff05bb Mon Sep 17 00:00:00 2001 From: Fabian Deutsch Date: Thu, 22 Apr 2010 12:50:33 +0000 Subject: [PATCH 24/57] Update schroedinger to 1.0.9. --- .cvsignore | 2 +- schroedinger-no-testsuite.patch | 15 +++++++++++++++ schroedinger.spec | 21 ++++++++++++++++----- sources | 2 +- 4 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 schroedinger-no-testsuite.patch diff --git a/.cvsignore b/.cvsignore index bbb34af..57bd9f2 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -schroedinger-1.0.8.tar.gz +schroedinger-1.0.9.tar.gz diff --git a/schroedinger-no-testsuite.patch b/schroedinger-no-testsuite.patch new file mode 100644 index 0000000..80cdc56 --- /dev/null +++ b/schroedinger-no-testsuite.patch @@ -0,0 +1,15 @@ +diff -u schroedinger-1.0.9/Makefile.in schroedinger-1.0.9.b/Makefile.in +--- schroedinger-1.0.9/Makefile.in 2010-03-04 10:04:43.000000000 +0100 ++++ schroedinger-1.0.9.b/Makefile.in 2010-03-05 20:47:06.000000000 +0100 +@@ -290,9 +290,9 @@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + AUTOMAKE_OPTIONS = foreign +-SUBDIRS = schroedinger doc tools testsuite ++SUBDIRS = schroedinger doc tools + DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc +-DIST_SUBDIRS = schroedinger doc tools testsuite ++DIST_SUBDIRS = schroedinger doc tools + EXTRA_DIST = COPYING COPYING.GPL COPYING.LGPL COPYING.MIT COPYING.MPL \ + autogen.sh schroedinger.spec TODO NEWS + diff --git a/schroedinger.spec b/schroedinger.spec index cec04dd..6f79251 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -1,8 +1,8 @@ %define abi 1.0 Name: schroedinger -Version: 1.0.8 -Release: 4%{?dist} +Version: 1.0.9 +Release: 2%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -10,10 +10,13 @@ Group: System Environment/Libraries License: GPL+ or LGPLv2+ or MIT or MPLv1.1 URL: http://www.diracvideo.org/ Source0: http://www.diracvideo.org/download/schroedinger/schroedinger-%{version}.tar.gz +# Issue is known upstream, fixed in git and so fixed in NEXT_RELEASE +Patch0: %{name}-no-testsuite.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: liboil-devel >= 0.3.16 +BuildRequires: orc-devel >= 0.4.3 BuildRequires: glew-devel >= 1.5.1 +BuildRequires: gtk-doc %description @@ -31,7 +34,7 @@ Group: Development/Libraries Summary: Development files for schroedinger Requires: %{name} = %{version}-%{release} Requires: pkgconfig -Requires: liboil-devel >= 0.3.16 +Requires: orc-devel >= 0.4.3 %description devel Development files for schroedinger @@ -39,7 +42,7 @@ Development files for schroedinger %prep %setup -q - +%patch0 -p1 %build %configure --disable-static --enable-gtk-doc @@ -76,6 +79,14 @@ rm -rf %{buildroot} %changelog +* Tue Apr 22 2010 Fabian Deutsch - 1.0.9-2 +- Added dependency on gtk-doc + +* Fri Mar 05 2010 Fabian Deutsch - 1.0.9-1 +- Update to 1.0.9 +- Dropped dependency on liboil +- Added dependency on orc + * Mon Feb 1 2010 Nicolas CHauvet - 1.0.8-4 - Remove gstreamer-plugins-schroedinger Obsoleted by gst-plugins-bad-free introduction in Fedora. diff --git a/sources b/sources index 5bac1a8..fc53a9e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -a76a7094f80419f81377b63432c64d01 schroedinger-1.0.8.tar.gz +d67ec48b7c506db8c8b49156bf409e60 schroedinger-1.0.9.tar.gz From b77981e03c22858e4ed0ee5f35733d9ba64338e1 Mon Sep 17 00:00:00 2001 From: Fabian Deutsch Date: Thu, 22 Apr 2010 13:22:14 +0000 Subject: [PATCH 25/57] Update schroedinger to 1.0.9 in F-13 branch. --- .cvsignore | 2 +- schroedinger-no-testsuite.patch | 15 +++++++++++++++ schroedinger.spec | 21 ++++++++++++++++----- sources | 2 +- 4 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 schroedinger-no-testsuite.patch diff --git a/.cvsignore b/.cvsignore index bbb34af..57bd9f2 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -schroedinger-1.0.8.tar.gz +schroedinger-1.0.9.tar.gz diff --git a/schroedinger-no-testsuite.patch b/schroedinger-no-testsuite.patch new file mode 100644 index 0000000..80cdc56 --- /dev/null +++ b/schroedinger-no-testsuite.patch @@ -0,0 +1,15 @@ +diff -u schroedinger-1.0.9/Makefile.in schroedinger-1.0.9.b/Makefile.in +--- schroedinger-1.0.9/Makefile.in 2010-03-04 10:04:43.000000000 +0100 ++++ schroedinger-1.0.9.b/Makefile.in 2010-03-05 20:47:06.000000000 +0100 +@@ -290,9 +290,9 @@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + AUTOMAKE_OPTIONS = foreign +-SUBDIRS = schroedinger doc tools testsuite ++SUBDIRS = schroedinger doc tools + DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc +-DIST_SUBDIRS = schroedinger doc tools testsuite ++DIST_SUBDIRS = schroedinger doc tools + EXTRA_DIST = COPYING COPYING.GPL COPYING.LGPL COPYING.MIT COPYING.MPL \ + autogen.sh schroedinger.spec TODO NEWS + diff --git a/schroedinger.spec b/schroedinger.spec index cec04dd..6f79251 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -1,8 +1,8 @@ %define abi 1.0 Name: schroedinger -Version: 1.0.8 -Release: 4%{?dist} +Version: 1.0.9 +Release: 2%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -10,10 +10,13 @@ Group: System Environment/Libraries License: GPL+ or LGPLv2+ or MIT or MPLv1.1 URL: http://www.diracvideo.org/ Source0: http://www.diracvideo.org/download/schroedinger/schroedinger-%{version}.tar.gz +# Issue is known upstream, fixed in git and so fixed in NEXT_RELEASE +Patch0: %{name}-no-testsuite.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: liboil-devel >= 0.3.16 +BuildRequires: orc-devel >= 0.4.3 BuildRequires: glew-devel >= 1.5.1 +BuildRequires: gtk-doc %description @@ -31,7 +34,7 @@ Group: Development/Libraries Summary: Development files for schroedinger Requires: %{name} = %{version}-%{release} Requires: pkgconfig -Requires: liboil-devel >= 0.3.16 +Requires: orc-devel >= 0.4.3 %description devel Development files for schroedinger @@ -39,7 +42,7 @@ Development files for schroedinger %prep %setup -q - +%patch0 -p1 %build %configure --disable-static --enable-gtk-doc @@ -76,6 +79,14 @@ rm -rf %{buildroot} %changelog +* Tue Apr 22 2010 Fabian Deutsch - 1.0.9-2 +- Added dependency on gtk-doc + +* Fri Mar 05 2010 Fabian Deutsch - 1.0.9-1 +- Update to 1.0.9 +- Dropped dependency on liboil +- Added dependency on orc + * Mon Feb 1 2010 Nicolas CHauvet - 1.0.8-4 - Remove gstreamer-plugins-schroedinger Obsoleted by gst-plugins-bad-free introduction in Fedora. diff --git a/sources b/sources index 5bac1a8..fc53a9e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -a76a7094f80419f81377b63432c64d01 schroedinger-1.0.8.tar.gz +d67ec48b7c506db8c8b49156bf409e60 schroedinger-1.0.9.tar.gz From e72c26d23e11646c62560cd93aaea468069c105b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 29 Jul 2010 12:08:47 +0000 Subject: [PATCH 26/57] dist-git conversion --- .cvsignore => .gitignore | 0 Makefile | 21 --------------------- branch | 1 - import.log | 2 -- 4 files changed, 24 deletions(-) rename .cvsignore => .gitignore (100%) delete mode 100644 Makefile delete mode 100644 branch delete mode 100644 import.log diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/Makefile b/Makefile deleted file mode 100644 index 0ebb7e9..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: schroedinger -# $Id: Makefile,v 1.1 2007/06/20 16:44:54 kevin Exp $ -NAME := schroedinger -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attept a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/branch b/branch deleted file mode 100644 index baa94ef..0000000 --- a/branch +++ /dev/null @@ -1 +0,0 @@ -F-13 diff --git a/import.log b/import.log deleted file mode 100644 index 8d0d441..0000000 --- a/import.log +++ /dev/null @@ -1,2 +0,0 @@ -schroedinger-1_0_8-3_fc11:HEAD:schroedinger-1.0.8-3.fc11.src.rpm:1256685452 -schroedinger-1_0_8-3_fc11:HEAD:schroedinger-1.0.8-3.fc11.src.rpm:1256685961 From a0686f54ad53bd8a3e53ca4be1b91a6d9fae4345 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 29 Jul 2010 12:08:50 +0000 Subject: [PATCH 27/57] dist-git conversion --- .cvsignore => .gitignore | 0 Makefile | 21 --------------------- import.log | 2 -- 3 files changed, 23 deletions(-) rename .cvsignore => .gitignore (100%) delete mode 100644 Makefile delete mode 100644 import.log diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/Makefile b/Makefile deleted file mode 100644 index 0ebb7e9..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: schroedinger -# $Id: Makefile,v 1.1 2007/06/20 16:44:54 kevin Exp $ -NAME := schroedinger -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attept a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/import.log b/import.log deleted file mode 100644 index 8d0d441..0000000 --- a/import.log +++ /dev/null @@ -1,2 +0,0 @@ -schroedinger-1_0_8-3_fc11:HEAD:schroedinger-1.0.8-3.fc11.src.rpm:1256685452 -schroedinger-1_0_8-3_fc11:HEAD:schroedinger-1.0.8-3.fc11.src.rpm:1256685961 From 005506a739b9eccd1563b32f5f4fe1b6aa7a5e88 Mon Sep 17 00:00:00 2001 From: Fabian Deutsch Date: Sun, 24 Oct 2010 11:40:02 +0200 Subject: [PATCH 28/57] Update to 1.0.10. Signed-off-by: Fabian Deutsch --- .gitignore | 1 + schroedinger-no-testsuite.patch | 15 --------------- schroedinger.spec | 25 ++++++++++++++++--------- sources | 2 +- 4 files changed, 18 insertions(+), 25 deletions(-) delete mode 100644 schroedinger-no-testsuite.patch diff --git a/.gitignore b/.gitignore index 57bd9f2..ffddaa5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ schroedinger-1.0.9.tar.gz +/schroedinger-1.0.10.tar.gz diff --git a/schroedinger-no-testsuite.patch b/schroedinger-no-testsuite.patch deleted file mode 100644 index 80cdc56..0000000 --- a/schroedinger-no-testsuite.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff -u schroedinger-1.0.9/Makefile.in schroedinger-1.0.9.b/Makefile.in ---- schroedinger-1.0.9/Makefile.in 2010-03-04 10:04:43.000000000 +0100 -+++ schroedinger-1.0.9.b/Makefile.in 2010-03-05 20:47:06.000000000 +0100 -@@ -290,9 +290,9 @@ - top_builddir = @top_builddir@ - top_srcdir = @top_srcdir@ - AUTOMAKE_OPTIONS = foreign --SUBDIRS = schroedinger doc tools testsuite -+SUBDIRS = schroedinger doc tools - DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --DIST_SUBDIRS = schroedinger doc tools testsuite -+DIST_SUBDIRS = schroedinger doc tools - EXTRA_DIST = COPYING COPYING.GPL COPYING.LGPL COPYING.MIT COPYING.MPL \ - autogen.sh schroedinger.spec TODO NEWS - diff --git a/schroedinger.spec b/schroedinger.spec index 6f79251..73716fa 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -1,22 +1,20 @@ %define abi 1.0 Name: schroedinger -Version: 1.0.9 -Release: 2%{?dist} +Version: 1.0.10 +Release: 1%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries # No version is given for the GPL or the LGPL License: GPL+ or LGPLv2+ or MIT or MPLv1.1 URL: http://www.diracvideo.org/ -Source0: http://www.diracvideo.org/download/schroedinger/schroedinger-%{version}.tar.gz -# Issue is known upstream, fixed in git and so fixed in NEXT_RELEASE -Patch0: %{name}-no-testsuite.patch +Source0: http://www.diracvideo.org/download/schroedinger/schroedinger-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: orc-devel >= 0.4.3 +BuildRequires: orc-devel >= 0.4.10 BuildRequires: glew-devel >= 1.5.1 -BuildRequires: gtk-doc +BuildRequires: gtk-doc %description @@ -34,7 +32,7 @@ Group: Development/Libraries Summary: Development files for schroedinger Requires: %{name} = %{version}-%{release} Requires: pkgconfig -Requires: orc-devel >= 0.4.3 +Requires: orc-devel >= 0.4.10 %description devel Development files for schroedinger @@ -42,7 +40,7 @@ Development files for schroedinger %prep %setup -q -%patch0 -p1 + %build %configure --disable-static --enable-gtk-doc @@ -53,23 +51,29 @@ sed -i.rpath 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool make %{?_smp_mflags} + %install rm -rf %{buildroot} make install DESTDIR=%{buildroot} find %{buildroot} -name \*.la -delete + %clean rm -rf %{buildroot} + %post -p /sbin/ldconfig + %postun -p /sbin/ldconfig + %files %defattr(-,root,root,-) %doc COPYING* NEWS TODO %{_libdir}/libschroedinger-%{abi}.so.* + %files devel %defattr(-,root,root,-) %doc %{_datadir}/gtk-doc/html/schroedinger @@ -79,6 +83,9 @@ rm -rf %{buildroot} %changelog +* Sun Oct 24 2010 Fabian Deutsch - 1.0.10-1 +- Update to 1.0.10 + * Tue Apr 22 2010 Fabian Deutsch - 1.0.9-2 - Added dependency on gtk-doc diff --git a/sources b/sources index fc53a9e..2fec319 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -d67ec48b7c506db8c8b49156bf409e60 schroedinger-1.0.9.tar.gz +9de088ccc314bb9e766cb3aa6510a0ef schroedinger-1.0.10.tar.gz From 544d14ee8cd095568ed307e69073087cc81af63f Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Wed, 9 Feb 2011 16:02:22 -0600 Subject: [PATCH 29/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index 73716fa..fd8754a 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.10 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -83,6 +83,9 @@ rm -rf %{buildroot} %changelog +* Wed Feb 09 2011 Fedora Release Engineering - 1.0.10-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + * Sun Oct 24 2010 Fabian Deutsch - 1.0.10-1 - Update to 1.0.10 From dd7985a4c8e041e2b2b2242fe17d5bd3a2f2ab43 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Fri, 13 Jan 2012 21:38:20 -0600 Subject: [PATCH 30/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index fd8754a..6d1f4c6 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.10 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -83,6 +83,9 @@ rm -rf %{buildroot} %changelog +* Sat Jan 14 2012 Fedora Release Engineering - 1.0.10-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + * Wed Feb 09 2011 Fedora Release Engineering - 1.0.10-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild From 75ea6446d48be8df849cce078c80c1e307716920 Mon Sep 17 00:00:00 2001 From: Fabian Deutsch Date: Mon, 23 Jan 2012 07:47:58 +0100 Subject: [PATCH 31/57] Update toi schroedinger-1.0.11 Signed-off-by: Fabian Deutsch --- .gitignore | 1 + schroedinger.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index ffddaa5..7d64a47 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ schroedinger-1.0.9.tar.gz /schroedinger-1.0.10.tar.gz +/schroedinger-1.0.11.tar.gz diff --git a/schroedinger.spec b/schroedinger.spec index 6d1f4c6..a2aaf19 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -1,8 +1,8 @@ %define abi 1.0 Name: schroedinger -Version: 1.0.10 -Release: 3%{?dist} +Version: 1.0.11 +Release: 1%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -83,6 +83,9 @@ rm -rf %{buildroot} %changelog +* Mon Jan 23 2012 Fabian Deutsch - 1.0.11-1 +- Update to 1.0.11 + * Sat Jan 14 2012 Fedora Release Engineering - 1.0.10-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild diff --git a/sources b/sources index 2fec319..00f1497 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -9de088ccc314bb9e766cb3aa6510a0ef schroedinger-1.0.10.tar.gz +da6af08e564ca1157348fb8d92efc891 schroedinger-1.0.11.tar.gz From ad40f27c8a6766e8fb7facbef4e508116284eded Mon Sep 17 00:00:00 2001 From: Fabian Deutsch Date: Fri, 27 Jan 2012 09:59:55 +0100 Subject: [PATCH 32/57] spec: Bump orc version. Signed-off-by: Fabian Deutsch --- schroedinger.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/schroedinger.spec b/schroedinger.spec index a2aaf19..c73ead1 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -12,7 +12,7 @@ URL: http://www.diracvideo.org/ Source0: http://www.diracvideo.org/download/schroedinger/schroedinger-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: orc-devel >= 0.4.10 +BuildRequires: orc-devel >= 0.4.16 BuildRequires: glew-devel >= 1.5.1 BuildRequires: gtk-doc @@ -83,6 +83,9 @@ rm -rf %{buildroot} %changelog +* Fri Jan 27 2012 Fabian Deutsch - 1.0.11-2 +- Bump required orc version to 0.4.16 + * Mon Jan 23 2012 Fabian Deutsch - 1.0.11-1 - Update to 1.0.11 From 8500f2a4b06976256ce738198e65d35434c2c069 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Sat, 21 Jul 2012 14:04:21 -0500 Subject: [PATCH 33/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index c73ead1..689ded8 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -83,6 +83,9 @@ rm -rf %{buildroot} %changelog +* Sat Jul 21 2012 Fedora Release Engineering - 1.0.11-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + * Fri Jan 27 2012 Fabian Deutsch - 1.0.11-2 - Bump required orc version to 0.4.16 From 5fd1070d8f250e5323e84784c283a3970306b113 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Thu, 14 Feb 2013 17:36:22 -0600 Subject: [PATCH 34/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index 689ded8..c5d42a6 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -83,6 +83,9 @@ rm -rf %{buildroot} %changelog +* Thu Feb 14 2013 Fedora Release Engineering - 1.0.11-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + * Sat Jul 21 2012 Fedora Release Engineering - 1.0.11-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild From cf338c899c510ce22c04351b1fb63a58a5c500ee Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Sun, 4 Aug 2013 08:43:49 -0500 Subject: [PATCH 35/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index c5d42a6..78e1bcc 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -83,6 +83,9 @@ rm -rf %{buildroot} %changelog +* Sun Aug 04 2013 Fedora Release Engineering - 1.0.11-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + * Thu Feb 14 2013 Fedora Release Engineering - 1.0.11-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild From 6f4e2a994f2878c12ec7d65f1e68061632c6d641 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Sun, 8 Jun 2014 00:54:24 -0500 Subject: [PATCH 36/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index 78e1bcc..e7a771a 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -83,6 +83,9 @@ rm -rf %{buildroot} %changelog +* Sun Jun 08 2014 Fedora Release Engineering - 1.0.11-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + * Sun Aug 04 2013 Fedora Release Engineering - 1.0.11-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild From e69b6abf280e3c2352ff58b4999117ee858e6e9d Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Mon, 18 Aug 2014 01:34:04 +0000 Subject: [PATCH 37/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index e7a771a..740417a 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -83,6 +83,9 @@ rm -rf %{buildroot} %changelog +* Mon Aug 18 2014 Fedora Release Engineering - 1.0.11-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + * Sun Jun 08 2014 Fedora Release Engineering - 1.0.11-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild From 1df4194afd893ecf94379b43b994f7c00b01e3e0 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Sat, 2 May 2015 17:36:38 +0200 Subject: [PATCH 38/57] Rebuilt for GCC 5 C++11 ABI change --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index 740417a..6d33c52 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -83,6 +83,9 @@ rm -rf %{buildroot} %changelog +* Sat May 02 2015 Kalev Lember - 1.0.11-8 +- Rebuilt for GCC 5 C++11 ABI change + * Mon Aug 18 2014 Fedora Release Engineering - 1.0.11-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild From 6b1fa08f95e19cb5b62ee6ded93b6ff90c31fbd2 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Fri, 19 Jun 2015 00:25:30 +0000 Subject: [PATCH 39/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index 6d33c52..e21b2a3 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -83,6 +83,9 @@ rm -rf %{buildroot} %changelog +* Fri Jun 19 2015 Fedora Release Engineering - 1.0.11-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + * Sat May 02 2015 Kalev Lember - 1.0.11-8 - Rebuilt for GCC 5 C++11 ABI change From c0f8c15750b120d134dfec364af20b65ca96ddf9 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 4 Feb 2016 23:42:03 +0000 Subject: [PATCH 40/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index e21b2a3..d4ade7f 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -83,6 +83,9 @@ rm -rf %{buildroot} %changelog +* Thu Feb 04 2016 Fedora Release Engineering - 1.0.11-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + * Fri Jun 19 2015 Fedora Release Engineering - 1.0.11-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild From a66feadd77c2639bdab1c4c5728252fe43863b7d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 11 Feb 2017 13:10:37 +0000 Subject: [PATCH 41/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index d4ade7f..fbb99e6 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -83,6 +83,9 @@ rm -rf %{buildroot} %changelog +* Sat Feb 11 2017 Fedora Release Engineering - 1.0.11-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + * Thu Feb 04 2016 Fedora Release Engineering - 1.0.11-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild From bf9fadfc6ea5d4e2abccdf7db2fb7b7ee7874606 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 27 Jul 2017 18:15:23 +0000 Subject: [PATCH 42/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index fbb99e6..44afe77 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -83,6 +83,9 @@ rm -rf %{buildroot} %changelog +* Thu Jul 27 2017 Fedora Release Engineering - 1.0.11-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + * Sat Feb 11 2017 Fedora Release Engineering - 1.0.11-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild From 6ad201b43ae9cb3c598298da65de05f74f7835bc Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 3 Aug 2017 08:12:14 +0000 Subject: [PATCH 43/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index 44afe77..e4d63a1 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 12%{?dist} +Release: 13%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -83,6 +83,9 @@ rm -rf %{buildroot} %changelog +* Thu Aug 03 2017 Fedora Release Engineering - 1.0.11-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + * Thu Jul 27 2017 Fedora Release Engineering - 1.0.11-12 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild From 647fb6863bb4cd57ea5469f8988066d045542223 Mon Sep 17 00:00:00 2001 From: Merlin Mathesius Date: Wed, 24 Jan 2018 08:14:07 -0600 Subject: [PATCH 44/57] Fix FTBFS by disabling regeneration of documentation at build time and using pregenerated docs included in upstream source. This is because gtkdoc-mktmpl has been removed as of gtk-doc-1.26. --- schroedinger.spec | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/schroedinger.spec b/schroedinger.spec index e4d63a1..65f0239 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 13%{?dist} +Release: 14%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -14,7 +14,6 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: orc-devel >= 0.4.16 BuildRequires: glew-devel >= 1.5.1 -BuildRequires: gtk-doc %description @@ -43,7 +42,7 @@ Development files for schroedinger %build -%configure --disable-static --enable-gtk-doc +%configure --disable-static # remove rpath from libtool sed -i.rpath 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool @@ -83,6 +82,11 @@ rm -rf %{buildroot} %changelog +* Wed Jan 24 2018 Merlin Mathesius - 1.0.11-14 +- Fix FTBFS by disabling regeneration of documentation at build time + and using pregenerated docs included in upstream source. This is + because gtkdoc-mktmpl has been removed as of gtk-doc-1.26. + * Thu Aug 03 2017 Fedora Release Engineering - 1.0.11-13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild @@ -131,7 +135,7 @@ rm -rf %{buildroot} * Sun Oct 24 2010 Fabian Deutsch - 1.0.10-1 - Update to 1.0.10 -* Tue Apr 22 2010 Fabian Deutsch - 1.0.9-2 +* Thu Apr 22 2010 Fabian Deutsch - 1.0.9-2 - Added dependency on gtk-doc * Fri Mar 05 2010 Fabian Deutsch - 1.0.9-1 @@ -172,7 +176,7 @@ rm -rf %{buildroot} * Wed Aug 27 2008 Jeffrey C. Ollie - 1.0.5-1 - Update to 1.0.5 -* Fri Jul 2 2008 Jeffrey C. Ollie - 1.0.3-2 +* Wed Jul 2 2008 Jeffrey C. Ollie - 1.0.3-2 - Devel subpackage needs to require liboil-devel. * Fri Jun 27 2008 Jeffrey C. Ollie - 1.0.3-1 From 645a18042381a960266fe8aeda9c3d134e58a659 Mon Sep 17 00:00:00 2001 From: Merlin Mathesius Date: Wed, 24 Jan 2018 12:49:27 -0600 Subject: [PATCH 45/57] Fix FTBFS in a better way by updating for compatibility with gtk-doc-1.26. --- schroedinger.spec | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/schroedinger.spec b/schroedinger.spec index 65f0239..fcf7bb1 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 14%{?dist} +Release: 15%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -14,6 +14,10 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: orc-devel >= 0.4.16 BuildRequires: glew-devel >= 1.5.1 +BuildRequires: gtk-doc +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool %description @@ -39,10 +43,13 @@ Development files for schroedinger %prep %setup -q +# fix compatibility with gtk-doc 1.26 +gtkdocize +autoreconf -fiv %build -%configure --disable-static +%configure --disable-static --enable-gtk-doc # remove rpath from libtool sed -i.rpath 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool @@ -82,6 +89,9 @@ rm -rf %{buildroot} %changelog +* Wed Jan 24 2018 Merlin Mathesius - 1.0.11-15 +- Fix FTBFS in a better way by updating for compatibility with gtk-doc-1.26. + * Wed Jan 24 2018 Merlin Mathesius - 1.0.11-14 - Fix FTBFS by disabling regeneration of documentation at build time and using pregenerated docs included in upstream source. This is From 68f778cb77e4bb2fa29d89414acc49463c2adec4 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 9 Feb 2018 16:15:38 +0000 Subject: [PATCH 46/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index fcf7bb1..6532ddc 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 15%{?dist} +Release: 16%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -89,6 +89,9 @@ rm -rf %{buildroot} %changelog +* Fri Feb 09 2018 Fedora Release Engineering - 1.0.11-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + * Wed Jan 24 2018 Merlin Mathesius - 1.0.11-15 - Fix FTBFS in a better way by updating for compatibility with gtk-doc-1.26. From 928052ba46c1c04656c483cc9b5f1379f98ac92f Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 14 Feb 2018 00:36:03 +0100 Subject: [PATCH 47/57] Remove BuildRoot definition None of currently supported distributions need that. It was needed last for EL5 which is EOL now Signed-off-by: Igor Gnatenko --- schroedinger.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index 6532ddc..1b111d6 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -10,7 +10,6 @@ Group: System Environment/Libraries License: GPL+ or LGPLv2+ or MIT or MPLv1.1 URL: http://www.diracvideo.org/ Source0: http://www.diracvideo.org/download/schroedinger/schroedinger-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: orc-devel >= 0.4.16 BuildRequires: glew-devel >= 1.5.1 From 51ad82487dfcde22c5961862f04abb6359643766 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 14 Feb 2018 07:39:05 +0100 Subject: [PATCH 48/57] Remove %clean section None of currently supported distributions need that. Last one was EL5 which is EOL for a while. Signed-off-by: Igor Gnatenko --- schroedinger.spec | 3 --- 1 file changed, 3 deletions(-) diff --git a/schroedinger.spec b/schroedinger.spec index 1b111d6..c756fca 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -63,9 +63,6 @@ make install DESTDIR=%{buildroot} find %{buildroot} -name \*.la -delete -%clean -rm -rf %{buildroot} - %post -p /sbin/ldconfig From cdbbf05a5bd49f1788630a4ed5018a49910bf6e6 Mon Sep 17 00:00:00 2001 From: Jason Tibbitts Date: Tue, 10 Jul 2018 01:18:36 -0500 Subject: [PATCH 49/57] Remove needless use of %defattr --- schroedinger.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/schroedinger.spec b/schroedinger.spec index c756fca..bdd9d38 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -71,13 +71,11 @@ find %{buildroot} -name \*.la -delete %files -%defattr(-,root,root,-) %doc COPYING* NEWS TODO %{_libdir}/libschroedinger-%{abi}.so.* %files devel -%defattr(-,root,root,-) %doc %{_datadir}/gtk-doc/html/schroedinger %{_includedir}/schroedinger-%{abi} %{_libdir}/*.so From 7b7fb34dc4dbfd9b555ac257fb82dc976965f6af Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 14 Jul 2018 05:48:38 +0000 Subject: [PATCH 50/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index bdd9d38..d06ad8c 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 16%{?dist} +Release: 17%{?dist} Summary: Portable libraries for the high quality Dirac video codec Group: System Environment/Libraries @@ -83,6 +83,9 @@ find %{buildroot} -name \*.la -delete %changelog +* Sat Jul 14 2018 Fedora Release Engineering - 1.0.11-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + * Fri Feb 09 2018 Fedora Release Engineering - 1.0.11-16 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild From f4dd929682b8da4405910e0e88fa9389ddce5c8f Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Sat, 21 Jul 2018 13:25:42 +0200 Subject: [PATCH 51/57] Wip version (still failing) --- schroedinger.spec | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/schroedinger.spec b/schroedinger.spec index d06ad8c..eb3bf39 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,15 +2,15 @@ Name: schroedinger Version: 1.0.11 -Release: 17%{?dist} +Release: 18%{?dist} Summary: Portable libraries for the high quality Dirac video codec -Group: System Environment/Libraries # No version is given for the GPL or the LGPL License: GPL+ or LGPLv2+ or MIT or MPLv1.1 -URL: http://www.diracvideo.org/ +URL: http://schrodinger.sourceforge.net/schrodinger_faq.php Source0: http://www.diracvideo.org/download/schroedinger/schroedinger-%{version}.tar.gz +BuildRequires: gcc BuildRequires: orc-devel >= 0.4.16 BuildRequires: glew-devel >= 1.5.1 BuildRequires: gtk-doc @@ -30,11 +30,9 @@ order to create a set of high quality decoder and encoder libraries for the Dirac video codec. %package devel -Group: Development/Libraries Summary: Development files for schroedinger -Requires: %{name} = %{version}-%{release} -Requires: pkgconfig -Requires: orc-devel >= 0.4.10 +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: orc-devel%{?_isa} >= 0.4.10 %description devel Development files for schroedinger @@ -54,24 +52,20 @@ autoreconf -fiv sed -i.rpath 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i.rpath 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool -make %{?_smp_mflags} +%make_build %install -rm -rf %{buildroot} -make install DESTDIR=%{buildroot} +%make_install find %{buildroot} -name \*.la -delete - -%post -p /sbin/ldconfig - - -%postun -p /sbin/ldconfig +%ldconfig_scriptlets %files -%doc COPYING* NEWS TODO +%doc NEWS TODO +%license COPYING* %{_libdir}/libschroedinger-%{abi}.so.* @@ -83,6 +77,9 @@ find %{buildroot} -name \*.la -delete %changelog +* Sat Jul 21 2018 Nicolas Chauvet - 1.0.11-18 +- Add missing cc + * Sat Jul 14 2018 Fedora Release Engineering - 1.0.11-17 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild From b16892a7af3e019dd9c3e784fd57746aa8aec503 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Mon, 13 Aug 2018 18:14:05 +0200 Subject: [PATCH 52/57] Avoid a race on library creation --- schroedinger.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/schroedinger.spec b/schroedinger.spec index eb3bf39..eb3980c 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -52,6 +52,8 @@ autoreconf -fiv sed -i.rpath 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i.rpath 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool +# Avoid a race on library creation +%make_build || %make_build -C schroedinger libschroedinger-1.0.la %make_build From 283656bf718a5c627c78605dfd79b3fcbb8aa814 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sun, 26 Aug 2018 22:36:52 +0100 Subject: [PATCH 53/57] add gcc-c++ dependency --- schroedinger.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index eb3980c..92fcdf6 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -10,7 +10,7 @@ License: GPL+ or LGPLv2+ or MIT or MPLv1.1 URL: http://schrodinger.sourceforge.net/schrodinger_faq.php Source0: http://www.diracvideo.org/download/schroedinger/schroedinger-%{version}.tar.gz -BuildRequires: gcc +BuildRequires: gcc gcc-c++ BuildRequires: orc-devel >= 0.4.16 BuildRequires: glew-devel >= 1.5.1 BuildRequires: gtk-doc From 841c6952160dba8fde0da220a3d91839b1d1c08b Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Mon, 27 Aug 2018 11:19:02 +0200 Subject: [PATCH 54/57] Revert "Avoid a race on library creation" This reverts commit b16892a7af3e019dd9c3e784fd57746aa8aec503. --- schroedinger.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/schroedinger.spec b/schroedinger.spec index 92fcdf6..74aac75 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -52,8 +52,6 @@ autoreconf -fiv sed -i.rpath 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i.rpath 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool -# Avoid a race on library creation -%make_build || %make_build -C schroedinger libschroedinger-1.0.la %make_build From 7bf23313bb3f21946ea57e469f8e8811316fade1 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Mon, 27 Aug 2018 11:24:12 +0200 Subject: [PATCH 55/57] Revert wrong workaround --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index 74aac75..edb2f73 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 18%{?dist} +Release: 19%{?dist} Summary: Portable libraries for the high quality Dirac video codec # No version is given for the GPL or the LGPL @@ -77,6 +77,9 @@ find %{buildroot} -name \*.la -delete %changelog +* Mon Aug 27 2018 Nicolas Chauvet - 1.0.11-19 +- Revert wrong workaround + * Sat Jul 21 2018 Nicolas Chauvet - 1.0.11-18 - Add missing cc From 9223362f2773275d53c8b2c3ed9ff95b7fc9c083 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 2 Feb 2019 14:55:06 +0000 Subject: [PATCH 56/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index edb2f73..4e4e91b 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 19%{?dist} +Release: 20%{?dist} Summary: Portable libraries for the high quality Dirac video codec # No version is given for the GPL or the LGPL @@ -77,6 +77,9 @@ find %{buildroot} -name \*.la -delete %changelog +* Sat Feb 02 2019 Fedora Release Engineering - 1.0.11-20 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + * Mon Aug 27 2018 Nicolas Chauvet - 1.0.11-19 - Revert wrong workaround From 523575e9a0e5d57cce4fe178c0894f8aaf057b48 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 26 Jul 2019 22:51:47 +0000 Subject: [PATCH 57/57] - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- schroedinger.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schroedinger.spec b/schroedinger.spec index 4e4e91b..8a50b1d 100644 --- a/schroedinger.spec +++ b/schroedinger.spec @@ -2,7 +2,7 @@ Name: schroedinger Version: 1.0.11 -Release: 20%{?dist} +Release: 21%{?dist} Summary: Portable libraries for the high quality Dirac video codec # No version is given for the GPL or the LGPL @@ -77,6 +77,9 @@ find %{buildroot} -name \*.la -delete %changelog +* Fri Jul 26 2019 Fedora Release Engineering - 1.0.11-21 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + * Sat Feb 02 2019 Fedora Release Engineering - 1.0.11-20 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild