1/*
2 *  Copyright (C) 2012 Igalia S.L
3 *
4 *  This library is free software; you can redistribute it and/or
5 *  modify it under the terms of the GNU Lesser General Public
6 *  License as published by the Free Software Foundation; either
7 *  version 2 of the License, or (at your option) any later version.
8 *
9 *  This library is distributed in the hope that it will be useful,
10 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 *  Lesser General Public License for more details.
13 *
14 *  You should have received a copy of the GNU Lesser General Public
15 *  License along with this library; if not, write to the Free Software
16 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18
19#include "Logging.h"
20
21#include <gst/gst.h>
22#include <gst/video/video.h>
23
24#define LOG_MEDIA_MESSAGE(...) do { \
25    GST_DEBUG(__VA_ARGS__); \
26    LOG_VERBOSE(Media, __VA_ARGS__); } while (0)
27
28#define ERROR_MEDIA_MESSAGE(...) do { \
29    GST_ERROR(__VA_ARGS__); \
30    LOG_VERBOSE(Media, __VA_ARGS__); } while (0)
31
32#define INFO_MEDIA_MESSAGE(...) do { \
33    GST_INFO(__VA_ARGS__); \
34    LOG_VERBOSE(Media, __VA_ARGS__); } while (0)
35
36#define WARN_MEDIA_MESSAGE(...) do { \
37    GST_WARNING(__VA_ARGS__); \
38    LOG_VERBOSE(Media, __VA_ARGS__); } while (0)
39
40namespace WebCore {
41
42class IntSize;
43
44inline bool webkitGstCheckVersion(guint major, guint minor, guint micro)
45{
46    guint currentMajor, currentMinor, currentMicro, currentNano;
47    gst_version(&currentMajor, &currentMinor, &currentMicro, &currentNano);
48
49    if (currentMajor < major)
50        return false;
51    if (currentMajor > major)
52        return true;
53
54    if (currentMinor < minor)
55        return false;
56    if (currentMinor > minor)
57        return true;
58
59    if (currentMicro < micro)
60        return false;
61
62    return true;
63}
64
65GstPad* webkitGstGhostPadFromStaticTemplate(GstStaticPadTemplate*, const gchar* name, GstPad* target);
66#if ENABLE(VIDEO)
67bool getVideoSizeAndFormatFromCaps(GstCaps*, WebCore::IntSize&, GstVideoFormat&, int& pixelAspectRatioNumerator, int& pixelAspectRatioDenominator, int& stride);
68#endif
69GstBuffer* createGstBuffer(GstBuffer*);
70GstBuffer* createGstBufferForData(const char* data, int length);
71char* getGstBufferDataPointer(GstBuffer*);
72void mapGstBuffer(GstBuffer*);
73void unmapGstBuffer(GstBuffer*);
74bool initializeGStreamer();
75unsigned getGstPlayFlag(const char* nick);
76GstClockTime toGstClockTime(float time);
77
78}
79