/**
 * GMyth Library
 *
 * @file gmyth/mmyth_tvplayer.h
 * 
 * @brief <p> This component provides playback of the remote A/V using
 * GStreamer.
 * 
 * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
 * @author Hallyson Luiz de Morais Melo <hallyson.melo@indt.org.br>
 *
 *//*
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef MMYTH_TVPLAYER_H_
#define MMYTH_TVPLAYER_H_

#include <glib-object.h>
#include <gtk/gtk.h>

/* GStreamer includes */
#include <gst/gst.h>
#include <gst/interfaces/xoverlay.h>

#include "gmyth_recorder.h"
#include "gmyth_tvchain.h"
#include "gmyth_common.h"

G_BEGIN_DECLS

#define MMYTH_TVPLAYER_TYPE               (mmyth_tvplayer_get_type ())
#define MMYTH_TVPLAYER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), MMYTH_TVPLAYER_TYPE, MMythTVPlayer))
#define MMYTH_TVPLAYER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), MMYTH_TVPLAYER_TYPE, MMythTVPlayerClass))
#define IS_MMYTH_TVPLAYER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), MMYTH_TVPLAYER_TYPE))
#define IS_MMYTH_TVPLAYER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), MMYTH_TVPLAYER_TYPE))
#define MMYTH_TVPLAYER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), MMYTH_TVPLAYER_TYPE, MMythTVPlayerClass))


typedef struct _MMythTVPlayer         MMythTVPlayer;
typedef struct _MMythTVPlayerClass    MMythTVPlayerClass;

struct _MMythTVPlayerClass
{
    GObjectClass parent_class;

      /* callbacks */
      /*  no one for now */
};

struct _MMythTVPlayer
{
    GObject parent;
    
    GstElement *gst_pipeline;
    GstElement *gst_source;
    GstElement *gst_videodec;
    GstElement *gst_videosink;
    GstElement *gst_videocolortrs; 
    GstElement *videoqueue1;
    GstElement *videoqueue2;
    GstElement *audioqueue1;
    GstElement *audioqueue2;
   
    gulong expose_handler;
//    GMainLoop *loop;
    
    GtkWidget *videow;

	/* Backend connection related variables */
	GString *backend_hostname;
	gint backend_port;
	GString *local_hostname;

	GMythRecorder *recorder;
	GMythTVChain *tvchain;
	GMythProgramInfo *proginfo;
	
	gboolean is_livetv;
};


GType          mmyth_tvplayer_get_type (void);

MMythTVPlayer* mmyth_tvplayer_new ();
gboolean       mmyth_tvplayer_initialize (MMythTVPlayer *tvplayer);

void           mmyth_tvplayer_start_playing   (MMythTVPlayer *tvplayer);
void           mmyth_tvplayer_stop_playing    (MMythTVPlayer *tvplayer);

gboolean       mmyth_tvplayer_set_widget   (MMythTVPlayer *tvplayer, 
                                            GtkWidget *videow);

gboolean       mmyth_tvplayer_is_playing   (MMythTVPlayer *tvplayer);

gboolean       mmyth_tvplayer_record_setup (MMythTVPlayer *tvplayer, 
                                            gchar *filename);
gboolean       mmyth_tvplayer_livetv_setup (MMythTVPlayer *tvplayer);

G_END_DECLS

#endif /*MMYTH_TVPLAYER_H_*/