[svn r45] Moved Myth FileTransfer, LiveTV and Myth URI to the gmyth library.
1.1 --- a/gst-plugins-mythtv/src/Makefile.am Mon Oct 23 20:02:26 2006 +0100
1.2 +++ b/gst-plugins-mythtv/src/Makefile.am Mon Oct 23 22:28:02 2006 +0100
1.3 @@ -3,10 +3,7 @@
1.4 plugin_LTLIBRARIES = libgstmythtvsrc.la
1.5
1.6 libgstmythtvsrc_la_SOURCES = \
1.7 - gstmythtvsrc.c \
1.8 - gmyth_uri.c \
1.9 - gmyth_file_transfer.c \
1.10 - gmyth_livetv.c
1.11 + gstmythtvsrc.c
1.12
1.13 libgstmythtvsrc_la_CFLAGS = \
1.14 $(GST_CFLAGS) \
1.15 @@ -20,8 +17,5 @@
1.16 $(GMYTH_LIBS)
1.17
1.18 noinst_HEADERS = \
1.19 - gstmythtvsrc.h \
1.20 - gmyth_uri.h \
1.21 - gmyth_file_transfer.h \
1.22 - gmyth_livetv.h
1.23 + gstmythtvsrc.h
1.24
2.1 --- a/gst-plugins-mythtv/src/Makefile.in Mon Oct 23 20:02:26 2006 +0100
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,547 +0,0 @@
2.4 -# Makefile.in generated by automake 1.9.6 from Makefile.am.
2.5 -# @configure_input@
2.6 -
2.7 -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2.8 -# 2003, 2004, 2005 Free Software Foundation, Inc.
2.9 -# This Makefile.in is free software; the Free Software Foundation
2.10 -# gives unlimited permission to copy and/or distribute it,
2.11 -# with or without modifications, as long as this notice is preserved.
2.12 -
2.13 -# This program is distributed in the hope that it will be useful,
2.14 -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
2.15 -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
2.16 -# PARTICULAR PURPOSE.
2.17 -
2.18 -@SET_MAKE@
2.19 -
2.20 -
2.21 -srcdir = @srcdir@
2.22 -top_srcdir = @top_srcdir@
2.23 -VPATH = @srcdir@
2.24 -pkgdatadir = $(datadir)/@PACKAGE@
2.25 -pkglibdir = $(libdir)/@PACKAGE@
2.26 -pkgincludedir = $(includedir)/@PACKAGE@
2.27 -top_builddir = ..
2.28 -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
2.29 -INSTALL = @INSTALL@
2.30 -install_sh_DATA = $(install_sh) -c -m 644
2.31 -install_sh_PROGRAM = $(install_sh) -c
2.32 -install_sh_SCRIPT = $(install_sh) -c
2.33 -INSTALL_HEADER = $(INSTALL_DATA)
2.34 -transform = $(program_transform_name)
2.35 -NORMAL_INSTALL = :
2.36 -PRE_INSTALL = :
2.37 -POST_INSTALL = :
2.38 -NORMAL_UNINSTALL = :
2.39 -PRE_UNINSTALL = :
2.40 -POST_UNINSTALL = :
2.41 -build_triplet = @build@
2.42 -host_triplet = @host@
2.43 -subdir = src
2.44 -DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
2.45 - $(srcdir)/Makefile.in
2.46 -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
2.47 -am__aclocal_m4_deps = $(top_srcdir)/m4/as-version.m4 \
2.48 - $(top_srcdir)/configure.ac
2.49 -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
2.50 - $(ACLOCAL_M4)
2.51 -mkinstalldirs = $(install_sh) -d
2.52 -CONFIG_HEADER = $(top_builddir)/config.h
2.53 -CONFIG_CLEAN_FILES =
2.54 -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
2.55 -am__vpath_adj = case $$p in \
2.56 - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
2.57 - *) f=$$p;; \
2.58 - esac;
2.59 -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
2.60 -am__installdirs = "$(DESTDIR)$(plugindir)"
2.61 -pluginLTLIBRARIES_INSTALL = $(INSTALL)
2.62 -LTLIBRARIES = $(plugin_LTLIBRARIES)
2.63 -am__DEPENDENCIES_1 =
2.64 -libgstmythtvsrc_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
2.65 -am_libgstmythtvsrc_la_OBJECTS = libgstmythtvsrc_la-gstmythtvsrc.lo \
2.66 - libgstmythtvsrc_la-gmyth_uri.lo \
2.67 - libgstmythtvsrc_la-gmyth_file_transfer.lo \
2.68 - libgstmythtvsrc_la-gmyth_livetv.lo
2.69 -libgstmythtvsrc_la_OBJECTS = $(am_libgstmythtvsrc_la_OBJECTS)
2.70 -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
2.71 -depcomp = $(SHELL) $(top_srcdir)/depcomp
2.72 -am__depfiles_maybe = depfiles
2.73 -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
2.74 - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
2.75 -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
2.76 - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
2.77 - $(AM_CFLAGS) $(CFLAGS)
2.78 -CCLD = $(CC)
2.79 -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
2.80 - $(AM_LDFLAGS) $(LDFLAGS) -o $@
2.81 -SOURCES = $(libgstmythtvsrc_la_SOURCES)
2.82 -DIST_SOURCES = $(libgstmythtvsrc_la_SOURCES)
2.83 -HEADERS = $(noinst_HEADERS)
2.84 -ETAGS = etags
2.85 -CTAGS = ctags
2.86 -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
2.87 -ACLOCAL = @ACLOCAL@
2.88 -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
2.89 -AMDEP_FALSE = @AMDEP_FALSE@
2.90 -AMDEP_TRUE = @AMDEP_TRUE@
2.91 -AMTAR = @AMTAR@
2.92 -AR = @AR@
2.93 -AUTOCONF = @AUTOCONF@
2.94 -AUTOHEADER = @AUTOHEADER@
2.95 -AUTOMAKE = @AUTOMAKE@
2.96 -AWK = @AWK@
2.97 -CC = @CC@
2.98 -CCDEPMODE = @CCDEPMODE@
2.99 -CFLAGS = @CFLAGS@
2.100 -CPP = @CPP@
2.101 -CPPFLAGS = @CPPFLAGS@
2.102 -CXX = @CXX@
2.103 -CXXCPP = @CXXCPP@
2.104 -CXXDEPMODE = @CXXDEPMODE@
2.105 -CXXFLAGS = @CXXFLAGS@
2.106 -CYGPATH_W = @CYGPATH_W@
2.107 -DEFS = @DEFS@
2.108 -DEPDIR = @DEPDIR@
2.109 -ECHO = @ECHO@
2.110 -ECHO_C = @ECHO_C@
2.111 -ECHO_N = @ECHO_N@
2.112 -ECHO_T = @ECHO_T@
2.113 -EGREP = @EGREP@
2.114 -EXEEXT = @EXEEXT@
2.115 -F77 = @F77@
2.116 -FFLAGS = @FFLAGS@
2.117 -GLIB_CFLAGS = @GLIB_CFLAGS@
2.118 -GLIB_LIBS = @GLIB_LIBS@
2.119 -GMYTH_CFLAGS = @GMYTH_CFLAGS@
2.120 -GMYTH_LIBS = @GMYTH_LIBS@
2.121 -GOBJECT_CFLAGS = @GOBJECT_CFLAGS@
2.122 -GOBJECT_LIBS = @GOBJECT_LIBS@
2.123 -GREP = @GREP@
2.124 -GSTBASE_CFLAGS = @GSTBASE_CFLAGS@
2.125 -GSTBASE_LIBS = @GSTBASE_LIBS@
2.126 -GST_CFLAGS = @GST_CFLAGS@
2.127 -GST_LIBS = @GST_LIBS@
2.128 -GST_MAJORMINOR = @GST_MAJORMINOR@
2.129 -GST_PLUGINS_DIR = @GST_PLUGINS_DIR@
2.130 -GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
2.131 -HAVE_PKGCONFIG = @HAVE_PKGCONFIG@
2.132 -HILDON_CFLAGS = @HILDON_CFLAGS@
2.133 -HILDON_LIBS = @HILDON_LIBS@
2.134 -INSTALL_DATA = @INSTALL_DATA@
2.135 -INSTALL_PROGRAM = @INSTALL_PROGRAM@
2.136 -INSTALL_SCRIPT = @INSTALL_SCRIPT@
2.137 -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
2.138 -LDFLAGS = @LDFLAGS@
2.139 -LIBOBJS = @LIBOBJS@
2.140 -LIBS = @LIBS@
2.141 -LIBTOOL = @LIBTOOL@
2.142 -LN_S = @LN_S@
2.143 -LTLIBOBJS = @LTLIBOBJS@
2.144 -MAEMO_PLATFORM_FALSE = @MAEMO_PLATFORM_FALSE@
2.145 -MAEMO_PLATFORM_TRUE = @MAEMO_PLATFORM_TRUE@
2.146 -MAINT = @MAINT@
2.147 -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
2.148 -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
2.149 -MAKEINFO = @MAKEINFO@
2.150 -MYTHTVSRC_MAJORMINOR = @MYTHTVSRC_MAJORMINOR@
2.151 -MYTHTVSRC_MAJOR_VERSION = @MYTHTVSRC_MAJOR_VERSION@
2.152 -MYTHTVSRC_MICRO_VERSION = @MYTHTVSRC_MICRO_VERSION@
2.153 -MYTHTVSRC_MINOR_VERSION = @MYTHTVSRC_MINOR_VERSION@
2.154 -MYTHTVSRC_NANO_VERSION = @MYTHTVSRC_NANO_VERSION@
2.155 -MYTHTVSRC_RELEASE = @MYTHTVSRC_RELEASE@
2.156 -MYTHTVSRC_VERSION = @MYTHTVSRC_VERSION@
2.157 -NDEBUG_FALSE = @NDEBUG_FALSE@
2.158 -NDEBUG_TRUE = @NDEBUG_TRUE@
2.159 -OBJEXT = @OBJEXT@
2.160 -PACKAGE = @PACKAGE@
2.161 -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
2.162 -PACKAGE_NAME = @PACKAGE_NAME@
2.163 -PACKAGE_STRING = @PACKAGE_STRING@
2.164 -PACKAGE_TARNAME = @PACKAGE_TARNAME@
2.165 -PACKAGE_VERSION = @PACKAGE_VERSION@
2.166 -PATH_SEPARATOR = @PATH_SEPARATOR@
2.167 -PKG_CONFIG = @PKG_CONFIG@
2.168 -RANLIB = @RANLIB@
2.169 -SET_MAKE = @SET_MAKE@
2.170 -SHELL = @SHELL@
2.171 -STRIP = @STRIP@
2.172 -VERSION = @VERSION@
2.173 -ac_ct_CC = @ac_ct_CC@
2.174 -ac_ct_CXX = @ac_ct_CXX@
2.175 -ac_ct_F77 = @ac_ct_F77@
2.176 -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
2.177 -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
2.178 -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
2.179 -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
2.180 -am__include = @am__include@
2.181 -am__leading_dot = @am__leading_dot@
2.182 -am__quote = @am__quote@
2.183 -am__tar = @am__tar@
2.184 -am__untar = @am__untar@
2.185 -bindir = @bindir@
2.186 -build = @build@
2.187 -build_alias = @build_alias@
2.188 -build_cpu = @build_cpu@
2.189 -build_os = @build_os@
2.190 -build_vendor = @build_vendor@
2.191 -datadir = @datadir@
2.192 -datarootdir = @datarootdir@
2.193 -docdir = @docdir@
2.194 -dvidir = @dvidir@
2.195 -exec_prefix = @exec_prefix@
2.196 -host = @host@
2.197 -host_alias = @host_alias@
2.198 -host_cpu = @host_cpu@
2.199 -host_os = @host_os@
2.200 -host_vendor = @host_vendor@
2.201 -htmldir = @htmldir@
2.202 -includedir = @includedir@
2.203 -infodir = @infodir@
2.204 -install_sh = @install_sh@
2.205 -libdir = @libdir@
2.206 -libexecdir = @libexecdir@
2.207 -localedir = @localedir@
2.208 -localstatedir = @localstatedir@
2.209 -mandir = @mandir@
2.210 -mkdir_p = @mkdir_p@
2.211 -oldincludedir = @oldincludedir@
2.212 -pdfdir = @pdfdir@
2.213 -prefix = @prefix@
2.214 -program_transform_name = @program_transform_name@
2.215 -psdir = @psdir@
2.216 -sbindir = @sbindir@
2.217 -sharedstatedir = @sharedstatedir@
2.218 -sysconfdir = @sysconfdir@
2.219 -target_alias = @target_alias@
2.220 -plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
2.221 -plugin_LTLIBRARIES = libgstmythtvsrc.la
2.222 -libgstmythtvsrc_la_SOURCES = \
2.223 - gstmythtvsrc.c \
2.224 - gmyth_uri.c \
2.225 - gmyth_file_transfer.c \
2.226 - gmyth_livetv.c
2.227 -
2.228 -libgstmythtvsrc_la_CFLAGS = \
2.229 - $(GST_CFLAGS) \
2.230 - $(GMYTH_CFLAGS)
2.231 -
2.232 -libgstmythtvsrc_la_LDFLAGS = \
2.233 - $(GST_PLUGIN_LDFLAGS)
2.234 -
2.235 -libgstmythtvsrc_la_LIBADD = \
2.236 - $(GST_BASE_LIBS) \
2.237 - $(GMYTH_LIBS)
2.238 -
2.239 -noinst_HEADERS = \
2.240 - gstmythtvsrc.h \
2.241 - gmyth_uri.h \
2.242 - gmyth_file_transfer.h \
2.243 - gmyth_livetv.h
2.244 -
2.245 -all: all-am
2.246 -
2.247 -.SUFFIXES:
2.248 -.SUFFIXES: .c .lo .o .obj
2.249 -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
2.250 - @for dep in $?; do \
2.251 - case '$(am__configure_deps)' in \
2.252 - *$$dep*) \
2.253 - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
2.254 - && exit 0; \
2.255 - exit 1;; \
2.256 - esac; \
2.257 - done; \
2.258 - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
2.259 - cd $(top_srcdir) && \
2.260 - $(AUTOMAKE) --gnu src/Makefile
2.261 -.PRECIOUS: Makefile
2.262 -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
2.263 - @case '$?' in \
2.264 - *config.status*) \
2.265 - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
2.266 - *) \
2.267 - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
2.268 - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
2.269 - esac;
2.270 -
2.271 -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
2.272 - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
2.273 -
2.274 -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
2.275 - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
2.276 -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
2.277 - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
2.278 -install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
2.279 - @$(NORMAL_INSTALL)
2.280 - test -z "$(plugindir)" || $(mkdir_p) "$(DESTDIR)$(plugindir)"
2.281 - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
2.282 - if test -f $$p; then \
2.283 - f=$(am__strip_dir) \
2.284 - echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(plugindir)/$$f'"; \
2.285 - $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(plugindir)/$$f"; \
2.286 - else :; fi; \
2.287 - done
2.288 -
2.289 -uninstall-pluginLTLIBRARIES:
2.290 - @$(NORMAL_UNINSTALL)
2.291 - @set -x; list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
2.292 - p=$(am__strip_dir) \
2.293 - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$p'"; \
2.294 - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$p"; \
2.295 - done
2.296 -
2.297 -clean-pluginLTLIBRARIES:
2.298 - -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
2.299 - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
2.300 - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
2.301 - test "$$dir" != "$$p" || dir=.; \
2.302 - echo "rm -f \"$${dir}/so_locations\""; \
2.303 - rm -f "$${dir}/so_locations"; \
2.304 - done
2.305 -libgstmythtvsrc.la: $(libgstmythtvsrc_la_OBJECTS) $(libgstmythtvsrc_la_DEPENDENCIES)
2.306 - $(LINK) -rpath $(plugindir) $(libgstmythtvsrc_la_LDFLAGS) $(libgstmythtvsrc_la_OBJECTS) $(libgstmythtvsrc_la_LIBADD) $(LIBS)
2.307 -
2.308 -mostlyclean-compile:
2.309 - -rm -f *.$(OBJEXT)
2.310 -
2.311 -distclean-compile:
2.312 - -rm -f *.tab.c
2.313 -
2.314 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstmythtvsrc_la-gmyth_file_transfer.Plo@am__quote@
2.315 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstmythtvsrc_la-gmyth_livetv.Plo@am__quote@
2.316 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstmythtvsrc_la-gmyth_uri.Plo@am__quote@
2.317 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstmythtvsrc_la-gstmythtvsrc.Plo@am__quote@
2.318 -
2.319 -.c.o:
2.320 -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
2.321 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
2.322 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
2.323 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.324 -@am__fastdepCC_FALSE@ $(COMPILE) -c $<
2.325 -
2.326 -.c.obj:
2.327 -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
2.328 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
2.329 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
2.330 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.331 -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
2.332 -
2.333 -.c.lo:
2.334 -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
2.335 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
2.336 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
2.337 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.338 -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
2.339 -
2.340 -libgstmythtvsrc_la-gstmythtvsrc.lo: gstmythtvsrc.c
2.341 -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmythtvsrc_la_CFLAGS) $(CFLAGS) -MT libgstmythtvsrc_la-gstmythtvsrc.lo -MD -MP -MF "$(DEPDIR)/libgstmythtvsrc_la-gstmythtvsrc.Tpo" -c -o libgstmythtvsrc_la-gstmythtvsrc.lo `test -f 'gstmythtvsrc.c' || echo '$(srcdir)/'`gstmythtvsrc.c; \
2.342 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgstmythtvsrc_la-gstmythtvsrc.Tpo" "$(DEPDIR)/libgstmythtvsrc_la-gstmythtvsrc.Plo"; else rm -f "$(DEPDIR)/libgstmythtvsrc_la-gstmythtvsrc.Tpo"; exit 1; fi
2.343 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gstmythtvsrc.c' object='libgstmythtvsrc_la-gstmythtvsrc.lo' libtool=yes @AMDEPBACKSLASH@
2.344 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.345 -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmythtvsrc_la_CFLAGS) $(CFLAGS) -c -o libgstmythtvsrc_la-gstmythtvsrc.lo `test -f 'gstmythtvsrc.c' || echo '$(srcdir)/'`gstmythtvsrc.c
2.346 -
2.347 -libgstmythtvsrc_la-gmyth_uri.lo: gmyth_uri.c
2.348 -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmythtvsrc_la_CFLAGS) $(CFLAGS) -MT libgstmythtvsrc_la-gmyth_uri.lo -MD -MP -MF "$(DEPDIR)/libgstmythtvsrc_la-gmyth_uri.Tpo" -c -o libgstmythtvsrc_la-gmyth_uri.lo `test -f 'gmyth_uri.c' || echo '$(srcdir)/'`gmyth_uri.c; \
2.349 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgstmythtvsrc_la-gmyth_uri.Tpo" "$(DEPDIR)/libgstmythtvsrc_la-gmyth_uri.Plo"; else rm -f "$(DEPDIR)/libgstmythtvsrc_la-gmyth_uri.Tpo"; exit 1; fi
2.350 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gmyth_uri.c' object='libgstmythtvsrc_la-gmyth_uri.lo' libtool=yes @AMDEPBACKSLASH@
2.351 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.352 -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmythtvsrc_la_CFLAGS) $(CFLAGS) -c -o libgstmythtvsrc_la-gmyth_uri.lo `test -f 'gmyth_uri.c' || echo '$(srcdir)/'`gmyth_uri.c
2.353 -
2.354 -libgstmythtvsrc_la-gmyth_file_transfer.lo: gmyth_file_transfer.c
2.355 -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmythtvsrc_la_CFLAGS) $(CFLAGS) -MT libgstmythtvsrc_la-gmyth_file_transfer.lo -MD -MP -MF "$(DEPDIR)/libgstmythtvsrc_la-gmyth_file_transfer.Tpo" -c -o libgstmythtvsrc_la-gmyth_file_transfer.lo `test -f 'gmyth_file_transfer.c' || echo '$(srcdir)/'`gmyth_file_transfer.c; \
2.356 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgstmythtvsrc_la-gmyth_file_transfer.Tpo" "$(DEPDIR)/libgstmythtvsrc_la-gmyth_file_transfer.Plo"; else rm -f "$(DEPDIR)/libgstmythtvsrc_la-gmyth_file_transfer.Tpo"; exit 1; fi
2.357 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gmyth_file_transfer.c' object='libgstmythtvsrc_la-gmyth_file_transfer.lo' libtool=yes @AMDEPBACKSLASH@
2.358 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.359 -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmythtvsrc_la_CFLAGS) $(CFLAGS) -c -o libgstmythtvsrc_la-gmyth_file_transfer.lo `test -f 'gmyth_file_transfer.c' || echo '$(srcdir)/'`gmyth_file_transfer.c
2.360 -
2.361 -libgstmythtvsrc_la-gmyth_livetv.lo: gmyth_livetv.c
2.362 -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmythtvsrc_la_CFLAGS) $(CFLAGS) -MT libgstmythtvsrc_la-gmyth_livetv.lo -MD -MP -MF "$(DEPDIR)/libgstmythtvsrc_la-gmyth_livetv.Tpo" -c -o libgstmythtvsrc_la-gmyth_livetv.lo `test -f 'gmyth_livetv.c' || echo '$(srcdir)/'`gmyth_livetv.c; \
2.363 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgstmythtvsrc_la-gmyth_livetv.Tpo" "$(DEPDIR)/libgstmythtvsrc_la-gmyth_livetv.Plo"; else rm -f "$(DEPDIR)/libgstmythtvsrc_la-gmyth_livetv.Tpo"; exit 1; fi
2.364 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gmyth_livetv.c' object='libgstmythtvsrc_la-gmyth_livetv.lo' libtool=yes @AMDEPBACKSLASH@
2.365 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.366 -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmythtvsrc_la_CFLAGS) $(CFLAGS) -c -o libgstmythtvsrc_la-gmyth_livetv.lo `test -f 'gmyth_livetv.c' || echo '$(srcdir)/'`gmyth_livetv.c
2.367 -
2.368 -mostlyclean-libtool:
2.369 - -rm -f *.lo
2.370 -
2.371 -clean-libtool:
2.372 - -rm -rf .libs _libs
2.373 -
2.374 -distclean-libtool:
2.375 - -rm -f libtool
2.376 -uninstall-info-am:
2.377 -
2.378 -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
2.379 - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
2.380 - unique=`for i in $$list; do \
2.381 - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
2.382 - done | \
2.383 - $(AWK) ' { files[$$0] = 1; } \
2.384 - END { for (i in files) print i; }'`; \
2.385 - mkid -fID $$unique
2.386 -tags: TAGS
2.387 -
2.388 -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
2.389 - $(TAGS_FILES) $(LISP)
2.390 - tags=; \
2.391 - here=`pwd`; \
2.392 - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
2.393 - unique=`for i in $$list; do \
2.394 - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
2.395 - done | \
2.396 - $(AWK) ' { files[$$0] = 1; } \
2.397 - END { for (i in files) print i; }'`; \
2.398 - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
2.399 - test -n "$$unique" || unique=$$empty_fix; \
2.400 - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
2.401 - $$tags $$unique; \
2.402 - fi
2.403 -ctags: CTAGS
2.404 -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
2.405 - $(TAGS_FILES) $(LISP)
2.406 - tags=; \
2.407 - here=`pwd`; \
2.408 - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
2.409 - unique=`for i in $$list; do \
2.410 - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
2.411 - done | \
2.412 - $(AWK) ' { files[$$0] = 1; } \
2.413 - END { for (i in files) print i; }'`; \
2.414 - test -z "$(CTAGS_ARGS)$$tags$$unique" \
2.415 - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
2.416 - $$tags $$unique
2.417 -
2.418 -GTAGS:
2.419 - here=`$(am__cd) $(top_builddir) && pwd` \
2.420 - && cd $(top_srcdir) \
2.421 - && gtags -i $(GTAGS_ARGS) $$here
2.422 -
2.423 -distclean-tags:
2.424 - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
2.425 -
2.426 -distdir: $(DISTFILES)
2.427 - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
2.428 - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
2.429 - list='$(DISTFILES)'; for file in $$list; do \
2.430 - case $$file in \
2.431 - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
2.432 - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
2.433 - esac; \
2.434 - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
2.435 - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
2.436 - if test "$$dir" != "$$file" && test "$$dir" != "."; then \
2.437 - dir="/$$dir"; \
2.438 - $(mkdir_p) "$(distdir)$$dir"; \
2.439 - else \
2.440 - dir=''; \
2.441 - fi; \
2.442 - if test -d $$d/$$file; then \
2.443 - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
2.444 - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
2.445 - fi; \
2.446 - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
2.447 - else \
2.448 - test -f $(distdir)/$$file \
2.449 - || cp -p $$d/$$file $(distdir)/$$file \
2.450 - || exit 1; \
2.451 - fi; \
2.452 - done
2.453 -check-am: all-am
2.454 -check: check-am
2.455 -all-am: Makefile $(LTLIBRARIES) $(HEADERS)
2.456 -installdirs:
2.457 - for dir in "$(DESTDIR)$(plugindir)"; do \
2.458 - test -z "$$dir" || $(mkdir_p) "$$dir"; \
2.459 - done
2.460 -install: install-am
2.461 -install-exec: install-exec-am
2.462 -install-data: install-data-am
2.463 -uninstall: uninstall-am
2.464 -
2.465 -install-am: all-am
2.466 - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
2.467 -
2.468 -installcheck: installcheck-am
2.469 -install-strip:
2.470 - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
2.471 - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
2.472 - `test -z '$(STRIP)' || \
2.473 - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
2.474 -mostlyclean-generic:
2.475 -
2.476 -clean-generic:
2.477 -
2.478 -distclean-generic:
2.479 - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
2.480 -
2.481 -maintainer-clean-generic:
2.482 - @echo "This command is intended for maintainers to use"
2.483 - @echo "it deletes files that may require special tools to rebuild."
2.484 -clean: clean-am
2.485 -
2.486 -clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \
2.487 - mostlyclean-am
2.488 -
2.489 -distclean: distclean-am
2.490 - -rm -rf ./$(DEPDIR)
2.491 - -rm -f Makefile
2.492 -distclean-am: clean-am distclean-compile distclean-generic \
2.493 - distclean-libtool distclean-tags
2.494 -
2.495 -dvi: dvi-am
2.496 -
2.497 -dvi-am:
2.498 -
2.499 -html: html-am
2.500 -
2.501 -info: info-am
2.502 -
2.503 -info-am:
2.504 -
2.505 -install-data-am: install-pluginLTLIBRARIES
2.506 -
2.507 -install-exec-am:
2.508 -
2.509 -install-info: install-info-am
2.510 -
2.511 -install-man:
2.512 -
2.513 -installcheck-am:
2.514 -
2.515 -maintainer-clean: maintainer-clean-am
2.516 - -rm -rf ./$(DEPDIR)
2.517 - -rm -f Makefile
2.518 -maintainer-clean-am: distclean-am maintainer-clean-generic
2.519 -
2.520 -mostlyclean: mostlyclean-am
2.521 -
2.522 -mostlyclean-am: mostlyclean-compile mostlyclean-generic \
2.523 - mostlyclean-libtool
2.524 -
2.525 -pdf: pdf-am
2.526 -
2.527 -pdf-am:
2.528 -
2.529 -ps: ps-am
2.530 -
2.531 -ps-am:
2.532 -
2.533 -uninstall-am: uninstall-info-am uninstall-pluginLTLIBRARIES
2.534 -
2.535 -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
2.536 - clean-libtool clean-pluginLTLIBRARIES ctags distclean \
2.537 - distclean-compile distclean-generic distclean-libtool \
2.538 - distclean-tags distdir dvi dvi-am html html-am info info-am \
2.539 - install install-am install-data install-data-am install-exec \
2.540 - install-exec-am install-info install-info-am install-man \
2.541 - install-pluginLTLIBRARIES install-strip installcheck \
2.542 - installcheck-am installdirs maintainer-clean \
2.543 - maintainer-clean-generic mostlyclean mostlyclean-compile \
2.544 - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
2.545 - tags uninstall uninstall-am uninstall-info-am \
2.546 - uninstall-pluginLTLIBRARIES
2.547 -
2.548 -# Tell versions [3.59,3.63) of GNU make to not export all variables.
2.549 -# Otherwise a system limit (for SysV at least) may be exceeded.
2.550 -.NOEXPORT:
3.1 --- a/gst-plugins-mythtv/src/gmyth_file_transfer.c Mon Oct 23 20:02:26 2006 +0100
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,1050 +0,0 @@
3.4 -/* vim: set sw=2: -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2; c-indent-level: 2-*- */
3.5 -/**
3.6 - * GStreamer plug-in properties:
3.7 - * - location (backend server hostname/URL) [ex.: myth://192.168.1.73:28722/1000_1092091.nuv]
3.8 - * - path (qurl - remote file to be opened)
3.9 - * - port number
3.10 - * @author Rosfran Lins Borges <rosfran.borges@indt.org.br>
3.11 - */
3.12 -
3.13 -#include "gmyth_file_transfer.h"
3.14 -#include "gmyth_uri.h"
3.15 -#include "gmyth_livetv.h"
3.16 -#include <gmyth/gmyth_util.h>
3.17 -#include <gmyth/gmyth_socket.h>
3.18 -#include <gmyth/gmyth_stringlist.h>
3.19 -
3.20 -#include <unistd.h>
3.21 -#include <glib.h>
3.22 -
3.23 -#include <arpa/inet.h>
3.24 -#include <sys/types.h>
3.25 -#include <sys/socket.h>
3.26 -#include <netdb.h>
3.27 -#include <errno.h>
3.28 -#include <stdlib.h>
3.29 -
3.30 -#define GMYTHTV_QUERY_HEADER "QUERY_FILETRANSFER"
3.31 -#define GMYTHTV_RECORDER_HEADER "QUERY_RECORDER"
3.32 -
3.33 -/* default values to the file transfer parameters */
3.34 -#define GMYTHTV_USER_READ_AHEAD FALSE
3.35 -#define GMYTHTV_RETRIES 1
3.36 -#define GMYTHTV_FILE_SIZE -1
3.37 -
3.38 -#define GMYTHTV_BUFFER_SIZE 8*1024
3.39 -
3.40 -#define GMYTHTV_VERSION 30
3.41 -
3.42 -#define GMYTHTV_TRANSFER_MAX_WAITS 700
3.43 -
3.44 -#ifdef GMYTHTV_ENABLE_DEBUG
3.45 -#define GMYTHTV_ENABLE_DEBUG 1
3.46 -#else
3.47 -#undef GMYTHTV_ENABLE_DEBUG
3.48 -#endif
3.49 -
3.50 -/* this NDEBUG is to maintain compatibility with GMyth library */
3.51 -#ifndef NDEBUG
3.52 -#define GMYTHTV_ENABLE_DEBUG 1
3.53 -#endif
3.54 -
3.55 -static guint wait_to_transfer = 0;
3.56 -
3.57 -enum myth_sock_types {
3.58 - GMYTH_PLAYBACK_TYPE = 0,
3.59 - GMYTH_MONITOR_TYPE,
3.60 - GMYTH_FILETRANSFER_TYPE,
3.61 - GMYTH_RINGBUFFER_TYPE
3.62 -};
3.63 -
3.64 -static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
3.65 -
3.66 -static GMainContext *io_watcher_context = NULL;
3.67 -
3.68 -static void gmyth_file_transfer_class_init (GMythFileTransferClass *klass);
3.69 -static void gmyth_file_transfer_init (GMythFileTransfer *object);
3.70 -
3.71 -static void gmyth_file_transfer_dispose (GObject *object);
3.72 -static void gmyth_file_transfer_finalize (GObject *object);
3.73 -
3.74 -static GMythSocket *myth_connect_to_transfer_backend( GMythFileTransfer **transfer, guint sock_type );
3.75 -static void* myth_init_io_watchers( void *data );
3.76 -
3.77 -void gmyth_file_transfer_close( GMythFileTransfer *transfer );
3.78 -
3.79 -G_DEFINE_TYPE(GMythFileTransfer, gmyth_file_transfer, G_TYPE_OBJECT)
3.80 -
3.81 -#if 0
3.82 -static guint64
3.83 -mmyth_util_decode_long_long( GMythStringList *strlist, guint offset )
3.84 -{
3.85 -
3.86 - guint64 ret_value = 0LL;
3.87 -
3.88 - g_return_val_if_fail( strlist != NULL, ret_value );
3.89 -
3.90 - if ( offset < gmyth_string_list_length( strlist ))
3.91 - g_printerr( "[%s] Offset is lower than the GMythStringList (offset = %d)!\n", __FUNCTION__, offset );
3.92 - g_return_val_if_fail( offset < gmyth_string_list_length( strlist ), ret_value );
3.93 -
3.94 - gint l1 = gmyth_string_list_get_int( strlist, offset );
3.95 - gint l2 = gmyth_string_list_get_int( strlist, offset + 1 );
3.96 -
3.97 - ret_value = ((guint64)(l2) & 0xffffffffLL) | ((guint64)(l1) << 32);
3.98 -
3.99 - return ret_value;
3.100 -
3.101 -}
3.102 -#endif
3.103 -
3.104 -static void
3.105 -gmyth_file_transfer_class_init (GMythFileTransferClass *klass)
3.106 -{
3.107 - GObjectClass *gobject_class;
3.108 -
3.109 - gobject_class = (GObjectClass *) klass;
3.110 -
3.111 - gobject_class->dispose = gmyth_file_transfer_dispose;
3.112 - gobject_class->finalize = gmyth_file_transfer_finalize;
3.113 -}
3.114 -
3.115 - static void
3.116 -gmyth_file_transfer_init (GMythFileTransfer *gmyth_file_transfer)
3.117 -{
3.118 - g_return_if_fail( gmyth_file_transfer != NULL );
3.119 - gmyth_file_transfer->mythtv_version = GMYTHTV_VERSION;
3.120 -}
3.121 -
3.122 -static void
3.123 -gmyth_file_transfer_dispose (GObject *object)
3.124 -{
3.125 - GMythFileTransfer *gmyth_file_transfer = GMYTH_FILE_TRANSFER(object);
3.126 -
3.127 - gmyth_file_transfer_close( gmyth_file_transfer );
3.128 -
3.129 - G_OBJECT_CLASS (gmyth_file_transfer_parent_class)->dispose (object);
3.130 -}
3.131 -
3.132 - static void
3.133 -gmyth_file_transfer_finalize (GObject *object)
3.134 -{
3.135 - g_signal_handlers_destroy (object);
3.136 -
3.137 - G_OBJECT_CLASS (gmyth_file_transfer_parent_class)->finalize (object);
3.138 -}
3.139 -
3.140 - GMythFileTransfer*
3.141 -gmyth_file_transfer_new (gint num, GString *uri_str, gshort port, gint mythtv_version)
3.142 -{
3.143 - GMythFileTransfer *transfer = GMYTH_FILE_TRANSFER ( g_object_new (
3.144 - GMYTH_FILE_TRANSFER_TYPE, FALSE ));
3.145 -
3.146 - if ( mythtv_version > 0 )
3.147 - transfer->mythtv_version = mythtv_version;
3.148 -
3.149 - transfer->card_id = num;
3.150 -
3.151 - transfer->rec_id = -1;
3.152 -
3.153 - transfer->recordernum = num;
3.154 - transfer->uri = gmyth_uri_new ( uri_str->str );
3.155 -
3.156 - transfer->hostname = g_string_new( gmyth_uri_gethost(transfer->uri) );
3.157 - g_print( "\t--> transfer->hostname = %s\n", transfer->hostname->str );
3.158 -
3.159 - if ( port >= 0 )
3.160 - transfer->port = port;
3.161 - else
3.162 - transfer->port = gmyth_uri_getport( transfer->uri );
3.163 -
3.164 - g_print( "\t--> transfer->port = %d\n", transfer->port );
3.165 -
3.166 - transfer->readposition = 0;
3.167 - transfer->filesize = GMYTHTV_FILE_SIZE;
3.168 - transfer->timeoutisfast = FALSE;
3.169 -
3.170 - transfer->userreadahead = GMYTHTV_USER_READ_AHEAD;
3.171 - transfer->retries = GMYTHTV_RETRIES;
3.172 -
3.173 - transfer->live_tv = FALSE;
3.174 -
3.175 - transfer->query = g_string_new( GMYTHTV_QUERY_HEADER );
3.176 - g_string_append_printf ( transfer->query, " %d", transfer->recordernum );
3.177 - g_print( "\t--> transfer->query = %s\n", transfer->query->str );
3.178 -
3.179 - transfer->control_sock = NULL;
3.180 - transfer->event_sock = NULL;
3.181 - transfer->sock = NULL;
3.182 -
3.183 - return transfer;
3.184 -}
3.185 -
3.186 -gboolean
3.187 -gmyth_file_transfer_livetv_setup( GMythFileTransfer **transfer, GMythSocket *live_socket )
3.188 -{
3.189 - (*transfer)->sock = live_socket;
3.190 - g_object_ref( live_socket );
3.191 -
3.192 - return TRUE;
3.193 -}
3.194 -
3.195 -gboolean
3.196 -gmyth_file_transfer_playback_setup( GMythFileTransfer **transfer, gboolean live_tv )
3.197 -{
3.198 -
3.199 - gboolean ret = TRUE;
3.200 -
3.201 - (*transfer)->live_tv = live_tv;
3.202 -
3.203 - printf("[%s] Running config to the %s...\n", __FUNCTION__, live_tv ? "LiveTV" : "FileTransfer" );
3.204 -
3.205 - /* configure the control socket */
3.206 - if ((*transfer)->control_sock == NULL) {
3.207 -
3.208 - if ( myth_connect_to_transfer_backend ( transfer, GMYTH_PLAYBACK_TYPE ) == NULL ) {
3.209 - g_printerr( "Connection to backend failed (Control Socket).\n" );
3.210 - ret = FALSE;
3.211 - }
3.212 -
3.213 - } else {
3.214 - g_warning("Remote transfer control socket already created.\n");
3.215 - }
3.216 -
3.217 - return ret;
3.218 -
3.219 -}
3.220 -
3.221 -gboolean
3.222 -gmyth_file_transfer_setup( GMythFileTransfer **transfer, gboolean live_tv )
3.223 -{
3.224 - GMythStringList *strlist = NULL;
3.225 -
3.226 - gboolean ret = TRUE;
3.227 -
3.228 - (*transfer)->live_tv = live_tv;
3.229 -
3.230 - printf("[%s] Running config to the %s...\n", __FUNCTION__, live_tv ? "LiveTV" : "FileTransfer" );
3.231 -
3.232 -#if 0
3.233 - /* configure the control socket */
3.234 - if ((*transfer)->event_sock == NULL) {
3.235 -
3.236 - if ( myth_connect_to_transfer_backend ( transfer, GMYTH_MONITOR_TYPE ) == NULL ) {
3.237 - g_printerr( "Connection to backend failed (Event Socket).\n" );
3.238 - ret = FALSE;
3.239 - }
3.240 -
3.241 - } else {
3.242 - g_warning("Remote transfer control socket already created.\n");
3.243 - }
3.244 -#endif
3.245 -
3.246 - /* configure the socket */
3.247 - if ( (*transfer)->sock == NULL ) {
3.248 -
3.249 - //if ( live_tv == FALSE ) {
3.250 -
3.251 - if ( myth_connect_to_transfer_backend ( transfer, GMYTH_FILETRANSFER_TYPE ) == NULL ) {
3.252 - g_printerr ("Connection to backend failed (Raw Transfer Socket).\n");
3.253 - ret = FALSE;
3.254 - }
3.255 -
3.256 - if ( !(*transfer)->live_tv && (*transfer)->control_sock != NULL) {
3.257 - strlist = gmyth_string_list_new();
3.258 - g_string_printf ( (*transfer)->query, "%s %d", GMYTHTV_QUERY_HEADER, (*transfer)->recordernum );
3.259 -
3.260 - gmyth_string_list_append_string( strlist, (*transfer)->query );
3.261 - gmyth_string_list_append_char_array( strlist, "IS_OPEN" );
3.262 -
3.263 - gmyth_socket_write_stringlist( (*transfer)->control_sock, strlist );
3.264 - gmyth_socket_read_stringlist( (*transfer)->control_sock, strlist );
3.265 -
3.266 - if ( strlist!=NULL && gmyth_string_list_get_int( strlist, 0 ) == 1 ) {
3.267 - g_print( "[%s] Remote Myth FileTransfer socket is open!\n", __FUNCTION__ );
3.268 - } else {
3.269 - g_print( "[%s] Remote Myth FileTransfer socket is CLOSED! See the MythTV Server Backend for configuration details...\n", __FUNCTION__ );
3.270 - ret = FALSE;
3.271 - }
3.272 - }
3.273 -
3.274 - } else {
3.275 - g_warning("Remote transfer (raw) socket already created.\n");
3.276 - }
3.277 -
3.278 - return ret;
3.279 -}
3.280 -
3.281 -static GMythSocket *
3.282 -myth_connect_to_transfer_backend( GMythFileTransfer **transfer, guint sock_type )
3.283 -{
3.284 - GMythSocket *sock = NULL;
3.285 -
3.286 - g_return_val_if_fail( transfer != NULL && *transfer != NULL, NULL );
3.287 - g_return_val_if_fail( (*transfer)->uri != NULL, NULL );
3.288 -
3.289 - g_static_mutex_lock (&mutex);
3.290 -
3.291 - gchar *path_dir = gmyth_uri_getpath( (*transfer)->uri );
3.292 - //g_print( "\t--> %s: path_dir = %s\n", __FUNCTION__, path_dir );
3.293 -
3.294 - gchar *stype = g_strdup( "" );
3.295 -
3.296 - // if ( (*transfer)->live_tv == FALSE ) {
3.297 -
3.298 - sock = gmyth_socket_new();
3.299 -
3.300 - gmyth_socket_connect( &sock, (*transfer)->hostname->str, (*transfer)->port );
3.301 -
3.302 - /*
3.303 - } else {
3.304 - sock = (*transfer)->sock;
3.305 - }
3.306 - */
3.307 -#ifdef GMYTHTV_ENABLE_DEBUG
3.308 -
3.309 - g_print( "[%s] --> Creating socket... (%s, %d)\n", __FUNCTION__, (*transfer)->hostname->str, (*transfer)->port );
3.310 -#endif
3.311 -
3.312 - GMythStringList *strlist = NULL;
3.313 -
3.314 - GString *hostname = g_string_new( gmyth_uri_gethost( (*transfer)->uri ) );
3.315 - GString *base_str = g_string_new( "" );
3.316 -
3.317 - if ( gmyth_socket_check_protocol_version_number (sock, (*transfer)->mythtv_version) ) {
3.318 -
3.319 - if (sock == NULL) {
3.320 - stype = (sock_type==GMYTH_PLAYBACK_TYPE) ? "control socket" : "file data socket";
3.321 - g_printerr( "FileTransfer, open_socket(%s): \n"
3.322 - "\t\t\tCould not connect to server \"%s\" @ port %d\n", stype,
3.323 - (*transfer)->hostname->str, (*transfer)->port );
3.324 - g_object_unref(sock);
3.325 - g_static_mutex_unlock (&mutex);
3.326 - return NULL;
3.327 - }
3.328 -
3.329 - hostname = gmyth_socket_get_local_hostname();
3.330 -
3.331 - g_print( "[%s] local hostname = %s\n", __FUNCTION__, hostname->str );
3.332 -
3.333 - if ( sock_type == GMYTH_PLAYBACK_TYPE )
3.334 - {
3.335 - (*transfer)->control_sock = sock;
3.336 - g_string_printf( base_str, "ANN Playback %s %d", hostname->str, TRUE );
3.337 -
3.338 - gmyth_socket_send_command( (*transfer)->control_sock, base_str );
3.339 - GString *resp = gmyth_socket_receive_response( (*transfer)->control_sock );
3.340 - g_print( "[%s] Got Playback response from %s: %s\n", __FUNCTION__, base_str->str, resp->str );
3.341 - }
3.342 - else if ( sock_type == GMYTH_MONITOR_TYPE )
3.343 - {
3.344 - (*transfer)->event_sock = sock;
3.345 - g_string_printf( base_str, "ANN Monitor %s %d", hostname->str, TRUE );
3.346 -
3.347 - gmyth_socket_send_command( (*transfer)->event_sock, base_str );
3.348 - GString *resp = gmyth_socket_receive_response( (*transfer)->event_sock );
3.349 - g_print( "[%s] Got Monitor response from %s: %s\n", __FUNCTION__, base_str->str, resp->str );
3.350 - //g_thread_create( myth_init_io_watchers, (void*)(*transfer), FALSE, NULL );
3.351 - myth_init_io_watchers ( (void*)(*transfer) );
3.352 -
3.353 - g_printerr( "[%s] Watch listener function to the IO control channel on thread %p.\n", __FUNCTION__, g_thread_self() );
3.354 -
3.355 - }
3.356 - else if ( sock_type == GMYTH_FILETRANSFER_TYPE )
3.357 - {
3.358 - (*transfer)->sock = sock;
3.359 - strlist = gmyth_string_list_new();
3.360 - //g_string_printf( base_str, "ANN FileTransfer %s %d %d", hostname->str,
3.361 - // transfer->userreadahead, transfer->retries );
3.362 - g_string_printf( base_str, "ANN FileTransfer %s", hostname->str );
3.363 -
3.364 - gmyth_string_list_append_string( strlist, base_str );
3.365 - gmyth_string_list_append_char_array( strlist, path_dir );
3.366 -
3.367 - gmyth_socket_write_stringlist( (*transfer)->sock, strlist );
3.368 - gmyth_socket_read_stringlist( (*transfer)->sock, strlist );
3.369 -
3.370 - /* socket number, where all the stream data comes from - got from the MythTV remote backend */
3.371 - (*transfer)->recordernum = gmyth_string_list_get_int( strlist, 1 );
3.372 -
3.373 - /* Myth URI stream file size - decoded using two 8-bytes sequences (64 bits/long long types) */
3.374 - (*transfer)->filesize = gmyth_util_decode_long_long( strlist, 2 );
3.375 -
3.376 - printf( "[%s] ***** Received: recordernum = %d, filesize = %" G_GUINT64_FORMAT "\n", __FUNCTION__,
3.377 - (*transfer)->recordernum, (*transfer)->filesize );
3.378 -
3.379 - if ( (*transfer)->filesize <= 0 ) {
3.380 - g_print( "[%s] Got filesize equals to %llu is lesser than 0 [invalid stream file]\n", __FUNCTION__, (*transfer)->filesize );
3.381 - g_object_unref(sock);
3.382 - sock = NULL;
3.383 - }
3.384 - }
3.385 - else if ( sock_type == GMYTH_RINGBUFFER_TYPE )
3.386 - {
3.387 - (*transfer)->sock = sock;
3.388 - //gmyth_file_transfer_spawntv( (*transfer), NULL );
3.389 -
3.390 - strlist = gmyth_string_list_new();
3.391 - g_string_printf( base_str, "ANN RingBuffer %s %d", hostname->str, (*transfer)->card_id );
3.392 -
3.393 - gmyth_socket_send_command( (*transfer)->sock, base_str );
3.394 - GString *resp = gmyth_socket_receive_response( (*transfer)->sock );
3.395 - g_print( "[%s] Got RingBuffer response from %s: %s\n", __FUNCTION__, base_str->str, resp->str );
3.396 -
3.397 - }
3.398 -
3.399 - }
3.400 -
3.401 - printf("[%s] ANN %s sent: %s\n", (sock_type==GMYTH_PLAYBACK_TYPE) ? "Playback" : (sock_type==GMYTH_FILETRANSFER_TYPE) ? "FileTransfer" : "Monitor", __FUNCTION__, base_str->str);
3.402 -
3.403 - if ( strlist != NULL )
3.404 - g_object_unref( strlist );
3.405 -
3.406 - g_static_mutex_unlock (&mutex);
3.407 -
3.408 - return sock;
3.409 -}
3.410 -
3.411 -void
3.412 -gmyth_file_transfer_spawntv ( GMythFileTransfer *file_transfer,
3.413 - GString *tvchain_id )
3.414 -{
3.415 - GMythStringList *str_list;
3.416 -
3.417 - g_debug ("gmyth_file_transfer_spawntv.\n");
3.418 -
3.419 - str_list = gmyth_string_list_new ();
3.420 -
3.421 - g_string_printf( file_transfer->query, "%s %d", GMYTHTV_RECORDER_HEADER,
3.422 - file_transfer->card_id );
3.423 - gmyth_string_list_append_string (str_list, file_transfer->query);
3.424 - gmyth_string_list_append_string (str_list, g_string_new ("SPAWN_LIVETV"));
3.425 - if (tvchain_id!=NULL) {
3.426 - gmyth_string_list_append_string (str_list, tvchain_id);
3.427 - gmyth_string_list_append_int (str_list, FALSE); // PIP = FALSE (0)
3.428 - }
3.429 -
3.430 - gmyth_socket_sendreceive_stringlist ( file_transfer->sock, str_list );
3.431 -
3.432 - //GString *str = NULL;
3.433 -
3.434 - //if (str_list!=NULL && (str = gmyth_string_list_get_string( str_list, 0 )) != NULL && strcasecmp( str->str, "ok" ) != 0 ) {
3.435 - // g_print( "[%s]\t\tSpawnLiveTV is OK!\n", __FUNCTION__ );
3.436 - //}
3.437 - if (str_list!=NULL)
3.438 - g_object_unref (str_list);
3.439 -
3.440 -}
3.441 -
3.442 -gboolean
3.443 -gmyth_file_transfer_is_recording ( GMythFileTransfer *file_transfer )
3.444 -{
3.445 - gboolean ret = TRUE;
3.446 -
3.447 - GMythStringList *str_list = gmyth_string_list_new ();
3.448 -
3.449 - g_debug ( "[%s]\n", __FUNCTION__ );
3.450 - g_static_mutex_lock (&mutex);
3.451 -
3.452 - g_string_printf( file_transfer->query, "%s %d", GMYTHTV_RECORDER_HEADER,
3.453 - file_transfer->rec_id >= 0 ? file_transfer->rec_id : file_transfer->card_id );
3.454 - gmyth_string_list_append_string (str_list, file_transfer->query);
3.455 - gmyth_string_list_append_string (str_list, g_string_new ("IS_RECORDING"));
3.456 -
3.457 - gmyth_socket_sendreceive_stringlist ( file_transfer->control_sock, str_list );
3.458 -
3.459 - if ( str_list != NULL && gmyth_string_list_length(str_list) > 0 )
3.460 - {
3.461 - GString *str = NULL;
3.462 - if ( ( str = gmyth_string_list_get_string( str_list, 0 ) ) != NULL && strcmp( str->str, "bad" )!= 0 ) {
3.463 - gint is_rec = gmyth_string_list_get_int( str_list, 0 );
3.464 - if ( is_rec != 0 )
3.465 - ret = TRUE;
3.466 - else
3.467 - ret = FALSE;
3.468 - }
3.469 - }
3.470 - g_print( "[%s] %s, stream is %s being recorded!\n", __FUNCTION__, ret ? "YES" : "NO", ret ? "" : "NOT" );
3.471 - g_static_mutex_unlock (&mutex);
3.472 -
3.473 - if ( str_list != NULL )
3.474 - g_object_unref (str_list);
3.475 -
3.476 - return ret;
3.477 -
3.478 -}
3.479 -
3.480 -gint64
3.481 -gmyth_file_transfer_get_file_position ( GMythFileTransfer *file_transfer )
3.482 -{
3.483 - gint64 pos = 0;
3.484 -
3.485 - GMythStringList *str_list = gmyth_string_list_new ();
3.486 -
3.487 - g_debug ( "[%s]\n", __FUNCTION__ );
3.488 - g_static_mutex_lock (&mutex);
3.489 -
3.490 - g_string_printf( file_transfer->query, "%s %d", GMYTHTV_RECORDER_HEADER,
3.491 - file_transfer->rec_id >= 0 ? file_transfer->rec_id : file_transfer->card_id );
3.492 -
3.493 - gmyth_string_list_append_string (str_list, file_transfer->query);
3.494 - gmyth_string_list_append_string (str_list, g_string_new ("GET_FILE_POSITION"));
3.495 -
3.496 - gmyth_socket_sendreceive_stringlist ( file_transfer->control_sock, str_list );
3.497 -
3.498 - if ( str_list != NULL && gmyth_string_list_length(str_list) > 0 )
3.499 - {
3.500 - GString *str = NULL;
3.501 - if ( ( str = gmyth_string_list_get_string( str_list, 0 ) ) != NULL && strstr ( str->str, "bad" ) == NULL )
3.502 - pos = gmyth_util_decode_long_long( str_list, 0 );
3.503 - }
3.504 - g_static_mutex_unlock (&mutex);
3.505 -
3.506 -#ifndef GMYTHTV_ENABLE_DEBUG
3.507 -
3.508 - g_print( "[%s] Got file position = %lld\n", __FUNCTION__, pos );
3.509 -#endif
3.510 - if (str_list!=NULL)
3.511 - g_object_unref (str_list);
3.512 -
3.513 - return pos;
3.514 -
3.515 -}
3.516 -
3.517 - glong
3.518 -gmyth_file_transfer_get_recordernum( GMythFileTransfer *transfer )
3.519 -{
3.520 - return transfer->recordernum;
3.521 -}
3.522 -
3.523 - glong
3.524 -gmyth_file_transfer_get_filesize( GMythFileTransfer *transfer )
3.525 -{
3.526 - return transfer->filesize;
3.527 -}
3.528 -
3.529 - gboolean
3.530 -gmyth_file_transfer_isopen( GMythFileTransfer *transfer )
3.531 -{
3.532 - return (transfer->sock != NULL && transfer->control_sock != NULL);
3.533 -}
3.534 -
3.535 - void
3.536 -gmyth_file_transfer_close( GMythFileTransfer *transfer )
3.537 -{
3.538 - GMythStringList *strlist;
3.539 -
3.540 - if (transfer->control_sock == NULL)
3.541 - return;
3.542 -
3.543 - strlist = gmyth_string_list_new( );
3.544 -
3.545 - g_string_printf( transfer->query, "%s %d", GMYTHTV_QUERY_HEADER,
3.546 - transfer->recordernum );
3.547 - gmyth_string_list_append_string( strlist, transfer->query );
3.548 - gmyth_string_list_append_char_array( strlist, "DONE" );
3.549 -
3.550 -
3.551 - if ( gmyth_socket_sendreceive_stringlist(transfer->control_sock, strlist) <= 0 )
3.552 - {
3.553 - g_printerr( "Remote file timeout.\n" );
3.554 - }
3.555 -
3.556 - if (transfer->sock)
3.557 - {
3.558 - g_object_unref( transfer->sock );
3.559 - transfer->sock = NULL;
3.560 - }
3.561 -
3.562 - if (transfer->control_sock)
3.563 - {
3.564 - g_object_unref( transfer->control_sock );
3.565 - transfer->control_sock = NULL;
3.566 - }
3.567 -
3.568 -}
3.569 -
3.570 - void
3.571 -gmyth_file_transfer_reset_controlsock( GMythFileTransfer *transfer )
3.572 -{
3.573 - if (transfer->control_sock == NULL)
3.574 - {
3.575 - g_printerr( "gmyth_file_transfer_reset_controlsock(): Called with no control socket" );
3.576 - return;
3.577 - }
3.578 -
3.579 - GString *str = gmyth_socket_receive_response( transfer->control_sock );
3.580 -
3.581 - g_string_free( str, TRUE );
3.582 -}
3.583 -
3.584 -void
3.585 -gmyth_file_transfer_reset_sock( GMythFileTransfer *transfer )
3.586 -{
3.587 - if ( transfer->sock == NULL )
3.588 - {
3.589 - g_printerr( "gmyth_file_transfer_reset_sock(): Called with no raw socket" );
3.590 - return;
3.591 - }
3.592 -
3.593 - GString *str = gmyth_socket_receive_response( transfer->sock );
3.594 -
3.595 - g_string_free( str, TRUE );
3.596 -}
3.597 -
3.598 -void
3.599 -gmyth_file_transfer_reset( GMythFileTransfer *transfer )
3.600 -{
3.601 - gmyth_file_transfer_reset_controlsock( transfer );
3.602 - gmyth_file_transfer_reset_sock( transfer );
3.603 -}
3.604 -
3.605 -gint64
3.606 -gmyth_file_transfer_seek(GMythFileTransfer *transfer, guint64 pos, gint whence)
3.607 -{
3.608 - if (transfer->sock == NULL)
3.609 - {
3.610 - g_printerr( "[%s] gmyth_file_transfer_seek(): Called with no socket", __FUNCTION__ );
3.611 - return 0;
3.612 - }
3.613 -
3.614 - if (transfer->control_sock == NULL)
3.615 - return 0;
3.616 -
3.617 - // if (!controlSock->isOpen() || controlSock->error())
3.618 - // return 0;
3.619 -
3.620 - GMythStringList *strlist = gmyth_string_list_new();
3.621 - g_string_printf (transfer->query, "%s %d", GMYTHTV_QUERY_HEADER, transfer->recordernum);
3.622 - gmyth_string_list_append_string( strlist, transfer->query );
3.623 - gmyth_string_list_append_char_array( strlist, "SEEK" );
3.624 - gmyth_string_list_append_uint64( strlist, pos );
3.625 -
3.626 - gmyth_string_list_append_int( strlist, whence );
3.627 -
3.628 - if (pos > 0 )
3.629 - gmyth_string_list_append_uint64( strlist, pos );
3.630 - else
3.631 - gmyth_string_list_append_uint64( strlist, transfer->readposition );
3.632 -
3.633 - gmyth_socket_sendreceive_stringlist( transfer->control_sock, strlist );
3.634 -
3.635 - gint64 retval = gmyth_string_list_get_int64(strlist, 0);
3.636 - transfer->readposition = retval;
3.637 - g_print( "[%s] got reading position pointer from the streaming = %lld\n",
3.638 - __FUNCTION__, retval );
3.639 -
3.640 - //gmyth_file_transfer_reset( transfer );
3.641 -
3.642 - return retval;
3.643 -}
3.644 -
3.645 -static gboolean
3.646 -myth_control_sock_listener( GIOChannel *source, GIOCondition condition, gpointer data )
3.647 -{
3.648 -
3.649 - GIOStatus ret;
3.650 - GError *err = NULL;
3.651 - gchar *msg = g_strdup("");
3.652 -
3.653 - g_static_mutex_lock( &mutex );
3.654 -
3.655 - gsize len;
3.656 - if (condition & G_IO_HUP)
3.657 - g_error ("Read end of pipe died!\n");
3.658 - ret = g_io_channel_read_line ( source, &msg, &len, NULL, &err);
3.659 - if ( ret == G_IO_STATUS_ERROR )
3.660 - g_error ("[%s] Error reading: %s\n", __FUNCTION__, err != NULL ? err->message : "" );
3.661 - g_print ("\n\n\n\n\n\n[%s]\t\tEVENT: Read %u bytes: %s\n\n\n\n\n", __FUNCTION__, len, msg != NULL ? msg : "" );
3.662 - if ( msg != NULL )
3.663 - g_free (msg);
3.664 -
3.665 - g_static_mutex_unlock( &mutex );
3.666 -
3.667 - return TRUE;
3.668 -
3.669 -}
3.670 -
3.671 -static void*
3.672 -myth_init_io_watchers( void *data )
3.673 -{
3.674 - GMythFileTransfer *transfer = (GMythFileTransfer*)data;
3.675 - io_watcher_context = g_main_context_new();
3.676 - GMainLoop *loop = g_main_loop_new( NULL, FALSE );
3.677 -
3.678 - GSource *source = NULL;
3.679 -
3.680 - if ( transfer->event_sock->sd_io_ch != NULL )
3.681 - source = g_io_create_watch( transfer->event_sock->sd_io_ch, G_IO_IN | G_IO_HUP );
3.682 - else
3.683 - goto cleanup;
3.684 -
3.685 - g_source_set_callback ( source, (GSourceFunc)myth_control_sock_listener, NULL, NULL );
3.686 -
3.687 - g_source_attach( source, io_watcher_context );
3.688 -
3.689 - if (source==NULL) {
3.690 - g_printerr( "[%s] Error adding watch listener function to the IO control channel!\n", __FUNCTION__ );
3.691 - goto cleanup;
3.692 - }
3.693 -
3.694 - g_print( "[%s]\tOK! Starting listener on the MONITOR event socket...\n", __FUNCTION__ );
3.695 -
3.696 - g_main_loop_run( loop );
3.697 -
3.698 -cleanup:
3.699 - if ( source != NULL )
3.700 - g_source_unref( source );
3.701 -
3.702 - g_main_loop_unref( loop );
3.703 -
3.704 - g_main_context_unref( io_watcher_context );
3.705 -
3.706 - return NULL;
3.707 -}
3.708 -
3.709 -
3.710 -gint
3.711 -gmyth_file_transfer_read(GMythFileTransfer *transfer, void *data, gint size, gboolean read_unlimited)
3.712 -{
3.713 - gint recv = 0;
3.714 - gsize bytes_read = 0;
3.715 - gint sent = 0;
3.716 - guint remaining = 0;
3.717 - gboolean response = FALSE;
3.718 -
3.719 - GIOChannel *io_channel;
3.720 - GIOChannel *io_channel_control;
3.721 -
3.722 - GIOCondition io_cond;
3.723 - GIOCondition io_cond_control;
3.724 - GIOStatus io_status = G_IO_STATUS_NORMAL, io_status_control = G_IO_STATUS_NORMAL;
3.725 -
3.726 - gint buf_len = GMYTHTV_BUFFER_SIZE;
3.727 -
3.728 - GMythStringList *strlist = NULL;
3.729 - GError *error = NULL;
3.730 -
3.731 - gchar *trash = g_strdup("");
3.732 -
3.733 - g_return_val_if_fail ( data != NULL, -2 );
3.734 -
3.735 - /* gets the size of the entire file, if the size requested is lesser than 0 */
3.736 - if ( size <= 0 )
3.737 - size = transfer->filesize;
3.738 -
3.739 - io_channel = transfer->sock->sd_io_ch;
3.740 - io_channel_control = transfer->control_sock->sd_io_ch;
3.741 -
3.742 - //g_io_channel_set_flags( io_channel, G_IO_FLAG_APPEND |
3.743 - // G_IO_STATUS_AGAIN | G_IO_FLAG_IS_READABLE | G_IO_FLAG_IS_WRITEABLE |
3.744 - // G_IO_FLAG_IS_SEEKABLE, NULL );
3.745 -
3.746 - io_status = g_io_channel_set_encoding( io_channel, NULL, &error );
3.747 - if ( io_status == G_IO_STATUS_NORMAL )
3.748 - g_print( "[%s] Setting encoding to binary data socket).\n", __FUNCTION__ );
3.749 -
3.750 - io_cond = g_io_channel_get_buffer_condition( io_channel );
3.751 -
3.752 - io_cond_control = g_io_channel_get_buffer_condition( io_channel );
3.753 -
3.754 - if ( transfer->sock == NULL || ( io_status == G_IO_STATUS_ERROR ) )
3.755 - {
3.756 - g_printerr( "gmyth_file_transfer_read(): Called with no raw socket.\n" );
3.757 - recv = -1;
3.758 - goto cleanup;
3.759 - }
3.760 -
3.761 - if ( transfer->control_sock == NULL || ( io_status_control == G_IO_STATUS_ERROR ) )
3.762 - {
3.763 - g_printerr( "gmyth_file_transfer_read(): Called with no control socket.\n" );
3.764 - recv = -1;
3.765 - goto cleanup;
3.766 - }
3.767 -
3.768 - /*
3.769 - if (!controlSock->isOpen() || controlSock->error())
3.770 - return -1;
3.771 - */
3.772 -
3.773 - if ( ( io_cond & G_IO_IN ) != 0 ) {
3.774 - do
3.775 - {
3.776 - trash = g_new0( gchar, GMYTHTV_BUFFER_SIZE );
3.777 -
3.778 - io_status = g_io_channel_read_chars( io_channel, trash,
3.779 - GMYTHTV_BUFFER_SIZE, &bytes_read, &error);
3.780 -
3.781 - g_print( "[%s] cleaning buffer on IO binary channel... %d bytes gone!\n",
3.782 - __FUNCTION__, bytes_read );
3.783 -
3.784 - if ( trash != NULL )
3.785 - g_free( trash );
3.786 -
3.787 - io_cond = g_io_channel_get_buffer_condition( io_channel );
3.788 -
3.789 - } while ( ( io_cond & G_IO_IN ) != 0 && ( io_status != G_IO_STATUS_ERROR ) && (error == NULL) );
3.790 -
3.791 - //if ( trash!= NULL )
3.792 - // g_free( trash );
3.793 - }
3.794 -
3.795 - if ( ( io_cond_control & G_IO_IN ) != 0 ) {
3.796 - GMythStringList *strlist_tmp = gmyth_string_list_new();
3.797 - gmyth_socket_read_stringlist( transfer->control_sock, strlist_tmp );
3.798 - g_object_unref( strlist_tmp );
3.799 - }
3.800 -
3.801 - wait_to_transfer = 0;
3.802 -
3.803 - //while ( transfer->live_tv && ( gmyth_file_transfer_get_file_position( transfer ) < 4096 ) &&
3.804 - // wait_to_transfer++ < GMYTHTV_TRANSFER_MAX_WAITS )
3.805 - // g_usleep( 1000*50 ); /* waits just for 2/10 second */
3.806 -
3.807 - //g_thread_create( myth_init_io_watchers, (void*)transfer, FALSE, NULL );
3.808 - //g_printerr( "[%s] Watch listener function to the IO control channel on thread %p.\n", __FUNCTION__, g_thread_self() );
3.809 -
3.810 - //g_static_mutex_lock (&mutex);
3.811 - //strlist = gmyth_string_list_new();
3.812 -
3.813 - g_string_printf ( transfer->query, "%s %d",
3.814 - /*transfer->live_tv ? GMYTHTV_RECORDER_HEADER :*/ GMYTHTV_QUERY_HEADER,
3.815 - /* transfer->live_tv ? transfer->card_id :*/ transfer->recordernum ); // transfer->recordernum
3.816 - g_print( "\t[%s] Transfer_query = %s\n", __FUNCTION__, transfer->query->str );
3.817 -
3.818 - sent = size;
3.819 - remaining = size - recv;
3.820 - //g_static_mutex_unlock( &mutex );
3.821 - //data = (void*)g_new0( gchar, size );
3.822 -
3.823 - //g_io_channel_flush( io_channel, NULL );
3.824 -
3.825 - //g_static_mutex_lock( &mutex );
3.826 -
3.827 - io_cond = g_io_channel_get_buffer_condition( io_channel );
3.828 -
3.829 - while ( recv < size && !response )//&& ( io_cond & G_IO_IN ) != 0 )
3.830 - {
3.831 - g_io_channel_flush( io_channel_control, NULL );
3.832 -
3.833 - strlist = gmyth_string_list_new();
3.834 - gmyth_string_list_append_char_array( strlist, transfer->query->str );
3.835 - gmyth_string_list_append_char_array( strlist,
3.836 - /*transfer->live_tv ? "REQUEST_BLOCK_RINGBUF" :*/ "REQUEST_BLOCK" );
3.837 - gmyth_string_list_append_int( strlist, remaining );
3.838 - gmyth_socket_write_stringlist( transfer->control_sock, strlist );
3.839 -
3.840 - guint count_bytes = 0;
3.841 -
3.842 - do
3.843 - {
3.844 - //buf_len = ( sent - recv ) > GMYTHTV_BUFFER_SIZE ? GMYTHTV_BUFFER_SIZE : ( sent - recv );
3.845 - if ( remaining > GMYTHTV_BUFFER_SIZE ) {
3.846 - buf_len = GMYTHTV_BUFFER_SIZE;
3.847 - } else {
3.848 - buf_len = remaining;
3.849 - }
3.850 -
3.851 - bytes_read = 0;
3.852 -
3.853 - io_status = g_io_channel_read_chars( io_channel, data + recv,
3.854 - buf_len, &bytes_read, &error );
3.855 -
3.856 - //g_static_mutex_unlock( &mutex );
3.857 - /*
3.858 - GString *sss = g_string_new("");
3.859 - sss = g_string_append_len( sss, (gchar*)data+recv, bytes_read );
3.860 -
3.861 - g_print( "[%s] Reading buffer (length = %d)\n", __FUNCTION__, bytes_read);
3.862 - */
3.863 - if ( bytes_read > 0 )
3.864 - {
3.865 - //if ( bytes_read <= buf_len )
3.866 - recv += bytes_read;
3.867 - count_bytes += bytes_read;
3.868 - remaining -= bytes_read;
3.869 - g_print( "[%s] Reading buffer (bytes read = %d, remaining = %d)\n", __FUNCTION__, bytes_read, remaining );
3.870 - if ( remaining == 0 ) {
3.871 - break;
3.872 - }
3.873 - } else {
3.874 - break;
3.875 - }
3.876 -
3.877 - //if ( remaining > 0 ) {
3.878 -
3.879 - if ( io_status == G_IO_STATUS_EOF ) {
3.880 - g_print( "[%s] got EOS!", __FUNCTION__ );
3.881 - break;
3.882 - } else if ( io_status == G_IO_STATUS_ERROR ) {
3.883 - g_print( "[%s] gmyth_file_transfer_read(): socket error.\n", __FUNCTION__ );
3.884 - break;
3.885 - }
3.886 - //}
3.887 -
3.888 - /* increase buffer size, to allow get more data (do not obey to the buffer size) */
3.889 - if ( read_unlimited == TRUE ) {
3.890 - // FOR NOW, DO NOTHING!!!
3.891 - //if ( recv > buf_len )
3.892 - // sent += (bytes_read - buf_len) + 1;
3.893 - }
3.894 -
3.895 - /* verify if the input (read) buffer is ready to receive data */
3.896 - io_cond = g_io_channel_get_buffer_condition( io_channel );
3.897 -
3.898 - g_print( "[%s]\t io_cond %s prepared for reading! (G_IO_IN) !!!\n\n", __FUNCTION__,
3.899 - ( ( io_cond & G_IO_IN ) != 0 ) ? "IS" : "IS NOT" );
3.900 -
3.901 - //if ( recv == size )
3.902 - //break;
3.903 -
3.904 - } while ( remaining > 0 );//&& ( io_status == G_IO_STATUS_NORMAL ) );
3.905 -
3.906 - // if ( ( recv < size ) ) {
3.907 - // finish_read = FALSE;
3.908 - //}
3.909 -
3.910 - io_cond_control = g_io_channel_get_buffer_condition( io_channel_control );
3.911 - if ( remaining == 0 )//( io_cond_control & G_IO_IN ) != 0 )
3.912 - {
3.913 - gmyth_socket_read_stringlist( transfer->control_sock, strlist );
3.914 - if ( strlist != NULL && gmyth_string_list_length( strlist ) > 0 )
3.915 - {
3.916 - sent = gmyth_string_list_get_int( strlist, 0 ); // -1 on backend error
3.917 - g_print( "[%s] got SENT buffer message = %d\n", __FUNCTION__, sent );
3.918 - if ( sent != 0 )
3.919 - {
3.920 - g_print( "[%s]\t received = %d bytes, backend says %d bytes sent, "\
3.921 - "io_cond %s prepared for reading! (G_IO_IN) !!!\n\n", __FUNCTION__,
3.922 - recv, sent, ( ( io_cond & G_IO_IN ) != 0 ) ? "IS" : "IS NOT" );
3.923 -
3.924 - if ( sent == count_bytes )
3.925 - {
3.926 - response = ( recv == size );
3.927 - g_print( "[%s]\t\tsent %d, which is equals to bytes_read = %d\n\n",
3.928 - __FUNCTION__, sent, count_bytes );
3.929 - if ( response == TRUE )
3.930 - break;
3.931 - }
3.932 - else
3.933 - {
3.934 - g_print( "[%s]\t\tsent %d, which is NOT equals to bytes_read = %d\n\n",
3.935 - __FUNCTION__, sent, count_bytes );
3.936 - goto cleanup;
3.937 - //response = FALSE;
3.938 - //break;
3.939 - }
3.940 - } else {
3.941 - break;
3.942 - //goto cleanup;
3.943 - } // if
3.944 - } // if - reading control response from backend
3.945 - } else {
3.946 - response = FALSE;
3.947 - } // if - stringlist response
3.948 -
3.949 - } // while
3.950 -
3.951 - io_cond_control = g_io_channel_get_buffer_condition( io_channel_control );
3.952 - // io_cond = g_io_channel_get_buffer_condition( io_channel );
3.953 -
3.954 - if ( ( ( io_cond_control & G_IO_IN ) != 0 ) &&
3.955 - ( response || ( recv == size ) ) )
3.956 - {
3.957 - if ( gmyth_socket_read_stringlist( transfer->control_sock, strlist ) > 0 )
3.958 - {
3.959 - if ( strlist != NULL && gmyth_string_list_length(strlist) > 0 )
3.960 - {
3.961 - sent = gmyth_string_list_get_int( strlist, 0 ); // -1 on backend error
3.962 - g_print( "[%s]\t received = %d bytes -\tNOW returning from reading buffer I/O socket "\
3.963 - "[%s prepared for reading]! (G_IO_IN) !!!\n\n", __FUNCTION__,
3.964 - sent, ( ( io_cond & G_IO_IN ) != 0 ) ? "IS" : "IS NOT" );
3.965 - }
3.966 - }
3.967 - else
3.968 - {
3.969 - g_printerr ( "gmyth_file_transfer_read(): No response from control socket.");
3.970 - recv = -1;
3.971 - }
3.972 -
3.973 - }
3.974 - else if ( error != NULL )
3.975 - {
3.976 - g_printerr( "[%s] Error occurred: (%d, %s)\n", __FUNCTION__, error->code, error->message );
3.977 - }
3.978 -
3.979 -cleanup:
3.980 - //g_static_mutex_unlock (&mutex);
3.981 -
3.982 - if ( trash != NULL )
3.983 - g_free( trash );
3.984 -
3.985 - if ( strlist != NULL )
3.986 - g_object_unref( strlist );
3.987 -
3.988 - g_print( "gmyth_file_transfer_read(): reqd=%d, rcvd=%d, rept=%d, "\
3.989 - "(rcvd and rept MUST be the same!)\n", size,
3.990 - recv, sent );
3.991 -
3.992 - //if ( ( recv != size ) || ( sent != size ) ) {
3.993 - //recv = size;
3.994 - //}
3.995 -
3.996 - if ( error != NULL ) {
3.997 - g_printerr( "Cleaning-up ERROR: %s [msg = %s, code = %d]\n", __FUNCTION__, error->message,
3.998 - error->code );
3.999 - g_error_free( error );
3.1000 - }
3.1001 -
3.1002 - return recv;
3.1003 -}
3.1004 -
3.1005 -void
3.1006 -gmyth_file_transfer_settimeout( GMythFileTransfer *transfer, gboolean fast )
3.1007 -{
3.1008 -
3.1009 - GMythStringList *strlist = NULL;
3.1010 -
3.1011 - if ( transfer->timeoutisfast == fast )
3.1012 - return;
3.1013 -
3.1014 - if ( transfer->sock == NULL )
3.1015 - {
3.1016 - g_printerr( "gmyth_file_transfer_settimeout(): Called with no socket" );
3.1017 - return;
3.1018 - }
3.1019 -
3.1020 - if ( transfer->control_sock == NULL )
3.1021 - return;
3.1022 -
3.1023 - strlist = gmyth_string_list_new();
3.1024 - gmyth_string_list_append_string( strlist, transfer->query );
3.1025 - gmyth_string_list_append_char_array( strlist, "SET_TIMEOUT" );
3.1026 - gmyth_string_list_append_int( strlist, fast );
3.1027 -
3.1028 - gmyth_socket_write_stringlist( transfer->control_sock, strlist );
3.1029 - gmyth_socket_read_stringlist( transfer->control_sock, strlist );
3.1030 -
3.1031 - transfer->timeoutisfast = fast;
3.1032 -
3.1033 -}
3.1034 -
3.1035 -#ifdef DO_TESTING
3.1036 -
3.1037 - int
3.1038 -main( int argc, char *argv[] )
3.1039 -{
3.1040 - g_type_init();
3.1041 -
3.1042 - GMythFileTransfer *file_transfer = gmyth_file_transfer_new( 1,
3.1043 - g_string_new("myth://192.168.1.109:6543/jshks.nuv"), -1, GMYTHTV_VERSION );
3.1044 - gmyth_file_transfer_setup( &file_transfer );
3.1045 - gchar *data = g_strdup("");
3.1046 -
3.1047 - gint num = gmyth_file_transfer_read( file_transfer, data, -1 );
3.1048 -
3.1049 - return 0;
3.1050 -
3.1051 -}
3.1052 -
3.1053 -#endif
4.1 --- a/gst-plugins-mythtv/src/gmyth_file_transfer.h Mon Oct 23 20:02:26 2006 +0100
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,93 +0,0 @@
4.4 -/* vim: set sw=2: -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2; c-indent-level: 2-*- */
4.5 -
4.6 -#ifndef __GMYTH_FILE_TRANSFER_H__
4.7 -#define __GMYTH_FILE_TRANSFER_H__
4.8 -
4.9 -#include <glib-object.h>
4.10 -
4.11 -#include <gmyth/gmyth_socket.h>
4.12 -#include "gmyth_uri.h"
4.13 -#include "gmyth_livetv.h"
4.14 -
4.15 -#include <stdio.h>
4.16 -#include <stdlib.h>
4.17 -#include <string.h>
4.18 -#include <netdb.h>
4.19 -#include <sys/socket.h>
4.20 -#include <unistd.h>
4.21 -
4.22 -#define G_BEGIN_DECLS
4.23 -
4.24 -#define GMYTH_FILE_TRANSFER_TYPE (gmyth_file_transfer_get_type ())
4.25 -#define GMYTH_FILE_TRANSFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransfer))
4.26 -#define GMYTH_FILE_TRANSFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransferClass))
4.27 -#define IS_GMYTH_FILE_TRANSFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_FILE_TRANSFER_TYPE))
4.28 -#define IS_GMYTH_FILE_TRANSFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_FILE_TRANSFER_TYPE))
4.29 -#define GMYTH_FILE_TRANSFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransferClass))
4.30 -
4.31 -
4.32 -typedef struct _GMythFileTransfer GMythFileTransfer;
4.33 -typedef struct _GMythFileTransferClass GMythFileTransferClass;
4.34 -
4.35 -struct _GMythFileTransferClass
4.36 -{
4.37 - GObjectClass parent_class;
4.38 -
4.39 - /* callbacks */
4.40 - /* no one for now */
4.41 -};
4.42 -
4.43 -struct _GMythFileTransfer
4.44 -{
4.45 - GObject parent;
4.46 -
4.47 - /* Myth URI structure */
4.48 - const GMythURI *uri;
4.49 -
4.50 - /* MythTV version number */
4.51 - gint mythtv_version;
4.52 -
4.53 - /* socket descriptors */
4.54 - GMythSocket *control_sock;
4.55 - GMythSocket *event_sock;
4.56 - GMythSocket *sock;
4.57 -
4.58 - guint64 readposition;
4.59 - guint64 filesize;
4.60 - gboolean timeoutisfast;
4.61 - gboolean userreadahead;
4.62 - gboolean live_tv;
4.63 - gint retries;
4.64 -
4.65 - GString *query;
4.66 -
4.67 - gint rec_id;
4.68 - gint recordernum;
4.69 - gint card_id;
4.70 - GString *hostname;
4.71 - gint port;
4.72 -};
4.73 -
4.74 -GType gmyth_file_transfer_get_type (void);
4.75 -
4.76 -GMythFileTransfer* gmyth_file_transfer_new (gint num, GString *hostname, gshort port, gint mythtv_version );
4.77 -
4.78 -gint gmyth_file_transfer_read(GMythFileTransfer *transfer, void *data, gint size, gboolean read_unlimited);
4.79 -
4.80 -gint64 gmyth_file_transfer_seek(GMythFileTransfer *transfer, guint64 pos, gint whence);
4.81 -
4.82 -gboolean gmyth_file_transfer_playback_setup( GMythFileTransfer **transfer, gboolean live_tv );
4.83 -
4.84 -gboolean gmyth_file_transfer_setup( GMythFileTransfer **transfer, gboolean live_tv );
4.85 -
4.86 -gboolean gmyth_file_transfer_livetv_setup( GMythFileTransfer **transfer, GMythSocket *live_sock );
4.87 -
4.88 -void gmyth_file_transfer_spawntv ( GMythFileTransfer *file_transfer, GString *tvchain_id );
4.89 -
4.90 -gboolean gmyth_file_transfer_is_recording( GMythFileTransfer *file_transfer );
4.91 -
4.92 -gint64 gmyth_file_transfer_get_file_position( GMythFileTransfer *file_transfer );
4.93 -
4.94 -#define G_END_DECLS
4.95 -
4.96 -#endif /* __GMYTH_FILE_TRANSFER_H__ */
5.1 --- a/gst-plugins-mythtv/src/gmyth_livetv.c Mon Oct 23 20:02:26 2006 +0100
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,220 +0,0 @@
5.4 -
5.5 -#include <gmyth/gmyth_context.h>
5.6 -#include <gmyth/gmyth_remote_util.h>
5.7 -#include <gmyth/gmyth_tvchain.h>
5.8 -
5.9 -#include "gmyth_livetv.h"
5.10 -#include "gmyth_file_transfer.h"
5.11 -
5.12 -static void gmyth_livetv_class_init (GMythLiveTVClass *klass);
5.13 -static void gmyth_livetv_init (GMythLiveTV *object);
5.14 -
5.15 -static void gmyth_livetv_dispose (GObject *object);
5.16 -static void gmyth_livetv_finalize (GObject *object);
5.17 -
5.18 -static gint tvchain_curr_index = -1;
5.19 -
5.20 -G_DEFINE_TYPE(GMythLiveTV, gmyth_livetv, G_TYPE_OBJECT)
5.21 -
5.22 -static void
5.23 -gmyth_livetv_class_init (GMythLiveTVClass *klass)
5.24 -{
5.25 - GObjectClass *gobject_class;
5.26 -
5.27 - gobject_class = (GObjectClass *) klass;
5.28 -
5.29 - gobject_class->dispose = gmyth_livetv_dispose;
5.30 - gobject_class->finalize = gmyth_livetv_finalize;
5.31 -}
5.32 -
5.33 -static void
5.34 -gmyth_livetv_init (GMythLiveTV *livetv)
5.35 -{
5.36 - livetv->backend_hostname = NULL;
5.37 - livetv->backend_port = 0;
5.38 - livetv->local_hostname = NULL;
5.39 -
5.40 - livetv->remote_encoder = NULL;
5.41 - livetv->tvchain = NULL;
5.42 - livetv->proginfo = NULL;
5.43 -}
5.44 -
5.45 -static void
5.46 -gmyth_livetv_dispose (GObject *object)
5.47 -{
5.48 -
5.49 - G_OBJECT_CLASS (gmyth_livetv_parent_class)->dispose (object);
5.50 -}
5.51 -
5.52 -static void
5.53 -gmyth_livetv_finalize (GObject *object)
5.54 -{
5.55 - g_signal_handlers_destroy (object);
5.56 -
5.57 - GMythLiveTV *livetv = GMYTH_LIVETV (object);
5.58 -
5.59 - g_debug ("[%s] Finalizing livetv", __FUNCTION__);
5.60 -
5.61 - if ( livetv->remote_encoder != NULL ) {
5.62 - g_object_unref (livetv->remote_encoder);
5.63 - livetv->remote_encoder = NULL;
5.64 - }
5.65 -
5.66 - if ( livetv->tvchain != NULL ) {
5.67 - g_object_unref (livetv->tvchain);
5.68 - livetv->tvchain = NULL;
5.69 - }
5.70 -
5.71 - if ( livetv->proginfo != NULL ) {
5.72 - g_object_unref (livetv->proginfo);
5.73 - livetv->proginfo = NULL;
5.74 - }
5.75 -
5.76 - G_OBJECT_CLASS ( gmyth_livetv_parent_class )->finalize ( object );
5.77 -}
5.78 -
5.79 -GMythLiveTV*
5.80 -gmyth_livetv_new ()
5.81 -{
5.82 - GMythLiveTV *livetv = GMYTH_LIVETV ( g_object_new( GMYTH_LIVETV_TYPE, NULL ) );
5.83 -
5.84 - return livetv;
5.85 -}
5.86 -
5.87 -gboolean
5.88 -gmyth_livetv_setup ( GMythLiveTV *livetv )
5.89 -{
5.90 - GMythSettings *msettings = gmyth_context_get_settings ();
5.91 - gboolean res = TRUE;
5.92 -
5.93 - livetv->is_livetv = TRUE;
5.94 -
5.95 - res = gmyth_context_check_connection();
5.96 - if (!res) {
5.97 - g_warning ("[%s] LiveTV can not connect to backend", __FUNCTION__);
5.98 - res = FALSE;
5.99 - goto error;
5.100 - }
5.101 -
5.102 - livetv->backend_hostname = gmyth_settings_get_backend_hostname(msettings);
5.103 - livetv->backend_port = gmyth_settings_get_backend_port (msettings);
5.104 -
5.105 - livetv->local_hostname = g_string_new("");
5.106 - gmyth_context_get_local_hostname (livetv->local_hostname);
5.107 -
5.108 - if ( livetv->local_hostname == NULL ) {
5.109 - res = FALSE;
5.110 - goto error;
5.111 - }
5.112 -
5.113 - // Gets the remote encoder num
5.114 - livetv->remote_encoder = remote_request_next_free_recorder (-1);
5.115 -
5.116 - if ( livetv->remote_encoder == NULL ) {
5.117 - g_warning ("[%s] None remote encoder available", __FUNCTION__);
5.118 - res = FALSE;
5.119 - goto error;
5.120 - }
5.121 -
5.122 - // Creates livetv chain handler
5.123 - livetv->tvchain = GMYTH_TVCHAIN ( g_object_new(GMYTH_TVCHAIN_TYPE, NULL) );
5.124 - gmyth_tvchain_initialize ( livetv->tvchain, livetv->local_hostname );
5.125 -
5.126 - if ( livetv->tvchain == NULL || livetv->tvchain->tvchain_id == NULL ) {
5.127 - res = FALSE;
5.128 - goto error;
5.129 - }
5.130 -
5.131 - // Init remote encoder. Opens its control socket.
5.132 - res = gmyth_remote_encoder_setup(livetv->remote_encoder);
5.133 - if ( !res ) {
5.134 - g_warning ("[%s] Fail while setting remote encoder\n", __FUNCTION__);
5.135 - res = FALSE;
5.136 - goto error;
5.137 - }
5.138 - // Spawn live tv. Uses the socket to send mythprotocol data to start livetv in the backend (remotelly)
5.139 - res = gmyth_remote_encoder_spawntv ( livetv->remote_encoder,
5.140 - gmyth_tvchain_get_id(livetv->tvchain) );
5.141 - if (!res) {
5.142 - g_warning ("[%s] Fail while spawn tv\n", __FUNCTION__);
5.143 - res = FALSE;
5.144 - goto error;
5.145 - }
5.146 -
5.147 - // Reload all TV chain from Mysql database.
5.148 - gmyth_tvchain_reload_all (livetv->tvchain);
5.149 -
5.150 - if ( livetv->tvchain == NULL ) {
5.151 - res = FALSE;
5.152 - goto error;
5.153 - }
5.154 -
5.155 - // Get program info from database using chanid and starttime
5.156 - livetv->proginfo = gmyth_tvchain_get_program_at (livetv->tvchain, tvchain_curr_index++ );
5.157 - if ( livetv->proginfo == NULL ) {
5.158 - g_warning ("[%s] LiveTV not successfully started.\n", __FUNCTION__ );
5.159 - res = FALSE;
5.160 - goto error;
5.161 - } else {
5.162 - g_debug ("[%s] GMythLiveTV: All requests to backend to start TV were OK.\n", __FUNCTION__ );
5.163 - }
5.164 -
5.165 - return res;
5.166 -
5.167 -error:
5.168 - if ( livetv->backend_hostname != NULL ) {
5.169 - g_string_free( livetv->backend_hostname, TRUE );
5.170 - res = FALSE;
5.171 - }
5.172 -
5.173 - if ( livetv->local_hostname != NULL ) {
5.174 - g_string_free( livetv->local_hostname, TRUE );
5.175 - res = FALSE;
5.176 - }
5.177 -
5.178 - if ( livetv->remote_encoder != NULL ) {
5.179 - g_object_unref (livetv->remote_encoder);
5.180 - livetv->remote_encoder = NULL;
5.181 - }
5.182 -
5.183 - if ( livetv->tvchain != NULL ) {
5.184 - g_object_unref (livetv->tvchain);
5.185 - livetv->tvchain = NULL;
5.186 - }
5.187 -
5.188 - if ( livetv->proginfo != NULL ) {
5.189 - g_object_unref (livetv->proginfo);
5.190 - livetv->proginfo = NULL;
5.191 - }
5.192 -
5.193 - return res;
5.194 -
5.195 -}
5.196 -
5.197 -// FIXME: How to proceed differently between livetv and recorded content
5.198 -void
5.199 -gmyth_livetv_stop_playing (GMythLiveTV *livetv)
5.200 -{
5.201 - g_debug ("[%s] Stopping the LiveTV...\n", __FUNCTION__);
5.202 -
5.203 - if (livetv->is_livetv) {
5.204 - if (!gmyth_remote_encoder_stop_livetv (livetv->remote_encoder)) {
5.205 - g_warning ("[%s] Error while stoping remote encoder", __FUNCTION__);
5.206 - }
5.207 - }
5.208 -}
5.209 -
5.210 -gboolean
5.211 -gmyth_livetv_is_playing (GMythLiveTV *livetv)
5.212 -{
5.213 - return TRUE;
5.214 -}
5.215 -
5.216 -void
5.217 -gmyth_livetv_start_playing (GMythLiveTV *livetv)
5.218 -{
5.219 -
5.220 - // TODO
5.221 -
5.222 -}
5.223 -
6.1 --- a/gst-plugins-mythtv/src/gmyth_livetv.h Mon Oct 23 20:02:26 2006 +0100
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,59 +0,0 @@
6.4 -#ifndef GMYTH_LIVETV_H_
6.5 -#define GMYTH_LIVETV_H_
6.6 -
6.7 -#include <glib-object.h>
6.8 -
6.9 -#include <gmyth/gmyth_remote_encoder.h>
6.10 -#include <gmyth/gmyth_tvchain.h>
6.11 -#include <gmyth/gmyth_common.h>
6.12 -
6.13 -#include "gmyth_file_transfer.h"
6.14 -
6.15 -#define G_BEGIN_DECLS
6.16 -
6.17 -#define GMYTH_LIVETV_TYPE (gmyth_livetv_get_type ())
6.18 -#define GMYTH_LIVETV(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_LIVETV_TYPE, GMythLiveTV))
6.19 -#define GMYTH_LIVETV_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_LIVETV_TYPE, GMythLiveTVClass))
6.20 -#define IS_GMYTH_LIVETV(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_LIVETV_TYPE))
6.21 -#define IS_GMYTH_LIVETV_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_LIVETV_TYPE))
6.22 -#define GMYTH_LIVETV_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_LIVETV_TYPE, GMythLiveTVClass))
6.23 -
6.24 -typedef struct _GMythLiveTV GMythLiveTV;
6.25 -typedef struct _GMythLiveTVClass GMythLiveTVClass;
6.26 -
6.27 -struct _GMythLiveTVClass
6.28 -{
6.29 - GObjectClass parent_class;
6.30 -
6.31 - /* callbacks */
6.32 -};
6.33 -
6.34 -struct _GMythLiveTV
6.35 -{
6.36 - GObject parent;
6.37 -
6.38 - // Backend connection related variables
6.39 - GString *backend_hostname;
6.40 - gint backend_port;
6.41 - GString *local_hostname;
6.42 -
6.43 - GMythRemoteEncoder *remote_encoder;
6.44 - GMythTVChain *tvchain;
6.45 - GMythProgramInfo *proginfo;
6.46 -
6.47 - gboolean is_livetv;
6.48 -
6.49 -};
6.50 -
6.51 -GType gmyth_livetv_get_type (void);
6.52 -
6.53 -GMythLiveTV* gmyth_livetv_new ();
6.54 -
6.55 -void gmyth_livetv_start_playing (GMythLiveTV *livetv);
6.56 -void gmyth_livetv_stop_playing (GMythLiveTV *livetv);
6.57 -
6.58 -gboolean gmyth_livetv_setup (GMythLiveTV *livetv);
6.59 -
6.60 -#define G_END_DECLS
6.61 -
6.62 -#endif /*GMYTH_LIVETV_H_*/
7.1 --- a/gst-plugins-mythtv/src/gmyth_uri.c Mon Oct 23 20:02:26 2006 +0100
7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
7.3 @@ -1,208 +0,0 @@
7.4 -/**
7.5 - *
7.6 - * GMythURI utils
7.7 - * - Extracts and parses a URI char string, in according with the RFC 2396
7.8 - * [http://www.ietf.org/rfc/rfc2396.txt]
7.9 - *
7.10 - * @author Rosfran Borges (rosfran.borges@indt.org.br)
7.11 - *
7.12 - */
7.13 -
7.14 -#include "gmyth_uri.h"
7.15 -#include <glib.h>
7.16 -#include <string.h>
7.17 -#include <stdlib.h>
7.18 -
7.19 -static gint
7.20 -gmyth_strstr( const gchar *haystack, const gchar *needle )
7.21 -{
7.22 -
7.23 - gchar *strPos;
7.24 -
7.25 - if (haystack == NULL || needle == NULL)
7.26 - return -1;
7.27 - strPos = strstr(haystack, needle);
7.28 - if (strPos == NULL)
7.29 - return -1;
7.30 -
7.31 - return (strPos - haystack);
7.32 -
7.33 -}
7.34 -
7.35 -static gboolean
7.36 -gmyth_uri_isabsolute( const GMythURI *uri )
7.37 -{
7.38 - gboolean ret = FALSE;
7.39 -
7.40 - g_return_val_if_fail( uri != NULL && uri->uri != NULL && uri->protocol != NULL, FALSE );
7.41 -
7.42 - if ( gmyth_strstr( uri->uri->str, GMYTH_URI_PROTOCOL_DELIM ) == 0 || strlen(uri->protocol->str) > 0 )
7.43 - ret = TRUE;
7.44 -
7.45 - return ret;
7.46 -}
7.47 -
7.48 -static gint
7.49 -gmyth_strrchr( const gchar *str, const gchar *chars, const gint nchars )
7.50 -{
7.51 -
7.52 - gint strLen;
7.53 - gint i, j;
7.54 -
7.55 - if ( str == NULL || chars == NULL )
7.56 - return -1;
7.57 -
7.58 - strLen = strlen( str );
7.59 - for ( i= (strLen-1); 0 <= i; i-- ) {
7.60 - for ( j=0; j<nchars; j++ ) {
7.61 - if ( str[i] == chars[j] )
7.62 - return i;
7.63 - }
7.64 - }
7.65 -
7.66 - return -1;
7.67 -
7.68 -}
7.69 -
7.70 -static GMythURI *
7.71 -gmyth_uri_init( )
7.72 -{
7.73 - GMythURI *uri = g_new0( GMythURI, 1 );
7.74 - uri->host = g_string_new("");
7.75 - uri->fragment = g_string_new("");
7.76 - uri->password = g_string_new("");
7.77 - uri->path = g_string_new("");
7.78 - uri->protocol = g_string_new("");
7.79 - uri->query = g_string_new("");
7.80 - uri->uri = g_string_new("");
7.81 - uri->user = g_string_new("");
7.82 - return uri;
7.83 -}
7.84 -
7.85 -const GMythURI *
7.86 -gmyth_uri_new( gchar *value )
7.87 -{
7.88 -
7.89 - GMythURI *uri = gmyth_uri_init();
7.90 -
7.91 - gchar *protocol;
7.92 - gint uriLen;
7.93 - gint currIdx;
7.94 - gint protoIdx;
7.95 - gint atIdx;
7.96 - gint colonIdx;
7.97 - gint shashIdx;
7.98 - gchar *host;
7.99 - gint eblacketIdx;
7.100 - GString *hostStr;
7.101 - GString *portStr;
7.102 - gint hostLen;
7.103 - gint sharpIdx;
7.104 - gint questionIdx;
7.105 - gint queryLen;
7.106 -
7.107 - uriLen = strlen(value);
7.108 - uri->uri = g_string_new( value );
7.109 -
7.110 - currIdx = 0;
7.111 -
7.112 - /*** Protocol ****/
7.113 - protoIdx = gmyth_strstr( value, GMYTH_URI_PROTOCOL_DELIM );
7.114 - if (0 < protoIdx) {
7.115 - uri->protocol = g_string_append_len( uri->protocol, value, protoIdx );
7.116 - currIdx += protoIdx + strlen( GMYTH_URI_PROTOCOL_DELIM );
7.117 - }
7.118 -
7.119 - /*** User (Password) ****/
7.120 - atIdx = gmyth_strstr( value+currIdx, GMYTH_URI_USER_DELIM );
7.121 - if ( 0 < atIdx ) {
7.122 - colonIdx = gmyth_strstr( value+currIdx, GMYTH_URI_COLON_DELIM );
7.123 -
7.124 - if (0 < colonIdx && colonIdx < atIdx) {
7.125 - uri->user = g_string_append_len( uri->user, value+currIdx, colonIdx );
7.126 - uri->password = g_string_append_len( uri->password, value+currIdx+colonIdx+1, atIdx-(colonIdx+1) );
7.127 - }
7.128 - else
7.129 - uri->user = g_string_append_len( uri->user, value+currIdx, atIdx - currIdx );
7.130 - currIdx += atIdx + 1;
7.131 - }
7.132 -
7.133 - /*** Host (Port) ****/
7.134 - shashIdx = gmyth_strstr( value+currIdx, GMYTH_URI_SLASH_DELIM );
7.135 - if ( 0 < shashIdx )
7.136 - uri->host = g_string_append_len( uri->host, value+currIdx, shashIdx );
7.137 - else if ( gmyth_uri_isabsolute(uri) == TRUE )
7.138 - uri->host = g_string_append_len( uri->host, value+currIdx, strlen(value) - currIdx );
7.139 - host = g_strdup( gmyth_uri_gethost(uri) );
7.140 - colonIdx = gmyth_strrchr( host, GMYTH_URI_COLON_DELIM, 1 );
7.141 - eblacketIdx = gmyth_strrchr( host, GMYTH_URI_EBLACET_DELIM, 1 );
7.142 - if ( ( 0 < colonIdx ) && ( eblacketIdx < colonIdx ) ) {
7.143 - hostStr = g_string_new( host );
7.144 -
7.145 - hostLen = hostStr->len;
7.146 - /**** host ****/
7.147 - uri->host = g_string_erase( uri->host, 0, hostLen );
7.148 - uri->host = g_string_insert_len( uri->host, 0, hostStr->str, colonIdx );
7.149 - //host = gmyth_uri_gethost( uri );
7.150 - if (0 < hostLen) {
7.151 - if (host[0] == '[' && host[hostLen-1] == ']')
7.152 - uri->host = g_string_append_len( uri->host, hostStr->str+1, colonIdx-2 );
7.153 - }
7.154 - /**** port ****/
7.155 - portStr = g_string_new("");
7.156 - portStr = g_string_append_len( portStr, hostStr->str+colonIdx+1, hostLen-colonIdx-1 );
7.157 - uri->port = atoi( portStr->str );
7.158 - g_string_free( portStr, TRUE );
7.159 - g_string_free( hostStr, FALSE );
7.160 - }
7.161 - else {
7.162 - uri->port = GMYTH_URI_KNKOWN_PORT;
7.163 - protocol = gmyth_uri_getprotocol(uri);
7.164 - if ( strcmp(protocol, GMYTH_URI_PROTOCOL_HTTP) == 0 )
7.165 - uri->port = GMYTH_URI_DEFAULT_HTTP_PORT;
7.166 - if ( strcmp(protocol, GMYTH_URI_PROTOCOL_FTP) == 0 )
7.167 - uri->port = GMYTH_URI_DEFAULT_FTP_PORT;
7.168 - }
7.169 -
7.170 - if (shashIdx > 0) currIdx += shashIdx;
7.171 -
7.172 - /*
7.173 - Handle relative URL
7.174 - */
7.175 - if (gmyth_uri_isabsolute(uri) == FALSE)
7.176 - {
7.177 -
7.178 - if (shashIdx != 0)
7.179 - {
7.180 - /* Add slash delimiter at the beginning of the URL,
7.181 - if it doesn't exist
7.182 - */
7.183 - uri->path = g_string_new( GMYTH_URI_SLASH_DELIM );
7.184 - }
7.185 - uri->path = g_string_append( uri->path, value );
7.186 -
7.187 - } else {
7.188 - /* First set path simply to the rest of URI */
7.189 - g_string_append_len( uri->path, value+currIdx, uriLen-currIdx );
7.190 - }
7.191 -
7.192 - /**** Path (Query/Fragment) ****/
7.193 - sharpIdx = gmyth_strstr(value+currIdx, GMYTH_URI_SHARP_DELIM);
7.194 - if (0 < sharpIdx) {
7.195 - uri->path = g_string_append_len( uri->path, value+currIdx, sharpIdx);
7.196 - uri->fragment = g_string_append_len( uri->fragment,
7.197 - value+currIdx+sharpIdx+1, uriLen-(currIdx+sharpIdx+1));
7.198 - }
7.199 -
7.200 - questionIdx = gmyth_strstr( value+currIdx, GMYTH_URI_QUESTION_DELIM );
7.201 - if ( 0 < questionIdx ) {
7.202 - uri->path = g_string_append_len( uri->path, value+currIdx, questionIdx );
7.203 - queryLen = uriLen-(currIdx+questionIdx+1);
7.204 - if ( 0 < sharpIdx )
7.205 - queryLen -= uriLen - (currIdx+sharpIdx+1);
7.206 - uri->query = g_string_append_len( uri->query, value+currIdx+questionIdx+1, queryLen );
7.207 - }
7.208 -
7.209 - return uri;
7.210 -
7.211 -}
8.1 --- a/gst-plugins-mythtv/src/gmyth_uri.h Mon Oct 23 20:02:26 2006 +0100
8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
8.3 @@ -1,63 +0,0 @@
8.4 -/**
8.5 - *
8.6 - * GMythURI utils
8.7 - * - Extracts and parses a URI char string, in according with the RFC 2396
8.8 - * [http://www.ietf.org/rfc/rfc2396.txt]
8.9 - *
8.10 - * @author Rosfran Borges (rosfran.borges@indt.org.br)
8.11 - *
8.12 - */
8.13 -
8.14 -#ifndef _GMYTH_URI_H_
8.15 -#define _GMYTH_URI_H_
8.16 -
8.17 -#include <glib.h>
8.18 -
8.19 -/****************************************
8.20 -* Define
8.21 -****************************************/
8.22 -
8.23 -#define GMYTH_URI_KNKOWN_PORT (-1)
8.24 -#define GMYTH_URI_DEFAULT_HTTP_PORT 80
8.25 -#define GMYTH_URI_DEFAULT_FTP_PORT 21
8.26 -#define GMYTH_URI_DEFAULT_PATH "/"
8.27 -#define GMYTH_URI_MAXLEN 256
8.28 -
8.29 -#define GMYTH_URI_PROTOCOL_DELIM "://"
8.30 -#define GMYTH_URI_USER_DELIM "@"
8.31 -#define GMYTH_URI_COLON_DELIM ":"
8.32 -#define GMYTH_URI_SLASH_DELIM "/"
8.33 -#define GMYTH_URI_SBLACET_DELIM "["
8.34 -#define GMYTH_URI_EBLACET_DELIM "]"
8.35 -#define GMYTH_URI_SHARP_DELIM "#"
8.36 -#define GMYTH_URI_QUESTION_DELIM "?"
8.37 -#define GMYTH_URI_ESCAPING_CHAR "%"
8.38 -
8.39 -#define GMYTH_URI_PROTOCOL_MYTH "myth"
8.40 -#define GMYTH_URI_PROTOCOL_HTTP "http"
8.41 -#define GMYTH_URI_PROTOCOL_FTP "ftp"
8.42 -
8.43 -/****************************************
8.44 -* Data Type
8.45 -****************************************/
8.46 -
8.47 -typedef struct _GMythURI {
8.48 - GString *uri;
8.49 - GString *host;
8.50 - gint port;
8.51 - GString *protocol;
8.52 - GString *path;
8.53 - GString *fragment;
8.54 - GString *user;
8.55 - GString *password;
8.56 - GString *query;
8.57 -} GMythURI;
8.58 -
8.59 -const GMythURI *gmyth_uri_new( gchar *value );
8.60 -
8.61 -#define gmyth_uri_gethost(urip) (urip->host->str)
8.62 -#define gmyth_uri_getport(urip) (urip->port)
8.63 -#define gmyth_uri_getprotocol(urip) (urip->protocol->str)
8.64 -#define gmyth_uri_getpath(urip) (urip->path->str)
8.65 -
8.66 -#endif
9.1 --- a/gst-plugins-mythtv/src/gstmythtvsrc.c Mon Oct 23 20:02:26 2006 +0100
9.2 +++ b/gst-plugins-mythtv/src/gstmythtvsrc.c Mon Oct 23 22:28:02 2006 +0100
9.3 @@ -303,6 +303,9 @@
9.4
9.5 if ( src->live_tv == FALSE ) {
9.6 goto done;
9.7 + } else if ( len == 0 ) {
9.8 + src->update_prog_chain = TRUE;
9.9 + goto done;
9.10 } else if ( /*src->content_size >= src->read_offset &&
9.11 abs ( src->content_size - src->read_offset ) <= 1024 ) ||*/
9.12 ( src->content_size <= ( src->read_offset + size + GMYTHTV_TRANSFER_MAX_BUFFER ) ) )