PageRenderTime 6ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 105 lines | 54 code | 17 blank | 34 comment | 0 complexity | d12af91554e8c789d0f5fdd427a95ebc MD5 | raw file
  1/**
  2 * @file llmediaimplgstreamervidplug.h
  3 * @brief Video-consuming static GStreamer plugin for gst-to-LLMediaImpl
  4 *
  5 * @cond
  6 * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  7 * Second Life Viewer Source Code
  8 * Copyright (C) 2010, Linden Research, Inc.
  9 * 
 10 * This library is free software; you can redistribute it and/or
 11 * modify it under the terms of the GNU Lesser General Public
 12 * License as published by the Free Software Foundation;
 13 * version 2.1 of the License only.
 14 * 
 15 * This library is distributed in the hope that it will be useful,
 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 18 * Lesser General Public License for more details.
 19 * 
 20 * You should have received a copy of the GNU Lesser General Public
 21 * License along with this library; if not, write to the Free Software
 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 23 * 
 24 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 25 * $/LicenseInfo$
 26 * @endcond
 27 */
 28
 29#ifndef __GST_SLVIDEO_H__
 30#define __GST_SLVIDEO_H__
 31
 32#if LL_GSTREAMER010_ENABLED
 33
 34extern "C" {
 35#include <gst/gst.h>
 36#include <gst/video/video.h>
 37#include <gst/video/gstvideosink.h>
 38}
 39
 40G_BEGIN_DECLS
 41
 42/* #defines don't like whitespacey bits */
 43#define GST_TYPE_SLVIDEO \
 44  (gst_slvideo_get_type())
 45#define GST_SLVIDEO(obj) \
 46  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SLVIDEO,GstSLVideo))
 47#define GST_SLVIDEO_CLASS(klass) \
 48  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SLVIDEO,GstSLVideoClass))
 49#define GST_IS_SLVIDEO(obj) \
 50  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SLVIDEO))
 51#define GST_IS_SLVIDEO_CLASS(klass) \
 52  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SLVIDEO))
 53
 54typedef struct _GstSLVideo      GstSLVideo;
 55typedef struct _GstSLVideoClass GstSLVideoClass;
 56
 57typedef enum {
 58	SLV_PF_UNKNOWN = 0,
 59	SLV_PF_RGBX    = 1,
 60	SLV_PF_BGRX    = 2,
 61	SLV__END       = 3
 62} SLVPixelFormat;
 63const int SLVPixelFormatBytes[SLV__END] = {1, 4, 4};
 64
 65struct _GstSLVideo
 66{
 67	GstVideoSink video_sink;
 68
 69	GstCaps *caps;
 70
 71	int fps_n, fps_d;
 72	int par_n, par_d;
 73	int height, width;
 74	SLVPixelFormat format;
 75
 76	// SHARED WITH APPLICATION:
 77	// Access to the following should be protected by GST_OBJECT_LOCK() on
 78	// the GstSLVideo object, and should be totally consistent upon UNLOCK
 79	// (i.e. all written at once to reflect the current retained frame info
 80	// when the retained frame is updated.)
 81	bool retained_frame_ready; // new frame ready since flag last reset. (*TODO: could get the writer to wait on a semaphore instead of having the reader poll, potentially making dropped frames somewhat cheaper.)
 82	unsigned char*  retained_frame_data;
 83	int retained_frame_allocbytes;
 84	int retained_frame_width, retained_frame_height;
 85	SLVPixelFormat retained_frame_format;
 86	// sticky resize info
 87	bool resize_forced_always;
 88	int resize_try_width;
 89	int resize_try_height;
 90};
 91
 92struct _GstSLVideoClass 
 93{
 94	GstVideoSinkClass parent_class;
 95};
 96
 97GType gst_slvideo_get_type (void);
 98
 99void gst_slvideo_init_class (void);
100
101G_END_DECLS
102
103#endif // LL_GSTREAMER010_ENABLED
104
105#endif /* __GST_SLVIDEO_H__ */