~ubuntu-branches/ubuntu/precise/gst-plugins-good0.10/precise-proposed

« back to all changes in this revision

Viewing changes to ext/shout2/gstshout2.c

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2012-02-22 11:31:28 UTC
  • mfrom: (1.6.24) (42.1.23 sid)
  • Revision ID: package-import@ubuntu.com-20120222113128-f079kh7u87k4vjfj
Tags: 0.10.31-1ubuntu1
Merge from Debian unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* GStreamer
2
2
 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3
3
 * Copyright (C) <2006> Tim-Philipp Müller <tim centricular net>
 
4
 * Copyright (C) <2012> Ralph Giles <giles@mozilla.com>
4
5
 *
5
6
 * This library is free software; you can redistribute it and/or
6
7
 * modify it under the terms of the GNU Library General Public
70
71
 
71
72
static GstElementClass *parent_class = NULL;
72
73
 
 
74
#ifdef SHOUT_FORMAT_WEBM
 
75
#define WEBM_CAPS "; video/webm"
 
76
#else
 
77
#define WEBM_CAPS ""
 
78
#endif
73
79
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
74
80
    GST_PAD_SINK,
75
81
    GST_PAD_ALWAYS,
76
82
    GST_STATIC_CAPS ("application/ogg; "
77
 
        "audio/mpeg, mpegversion = (int) 1, layer = (int) [ 1, 3 ]")
78
 
    );
 
83
        "audio/mpeg, mpegversion = (int) 1, layer = (int) [ 1, 3 ]" WEBM_CAPS));
 
84
 
79
85
static void gst_shout2send_class_init (GstShout2sendClass * klass);
80
86
static void gst_shout2send_base_init (GstShout2sendClass * klass);
81
87
static void gst_shout2send_init (GstShout2send * shout2send);
160
166
{
161
167
  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
162
168
 
163
 
  gst_element_class_add_static_pad_template (element_class,
164
 
      &sink_template);
 
169
  gst_element_class_add_static_pad_template (element_class, &sink_template);
165
170
  gst_element_class_set_details_simple (element_class, "Icecast network sink",
166
171
      "Sink/Network", "Sends data to an icecast server",
167
172
      "Wim Taymans <wim.taymans@chello.be>, "
538
543
static gboolean
539
544
gst_shout2send_connect (GstShout2send * sink)
540
545
{
541
 
  GST_DEBUG_OBJECT (sink, "Connection format is: %s",
 
546
  const char *format =
542
547
      (sink->audio_format == SHOUT_FORMAT_VORBIS) ? "vorbis" :
543
 
      ((sink->audio_format == SHOUT_FORMAT_MP3) ? "mp3" : "unknown"));
 
548
      ((sink->audio_format == SHOUT_FORMAT_MP3) ? "mp3" : "unknown");
 
549
#ifdef SHOUT_FORMAT_WEBM
 
550
  if (sink->audio_format == SHOUT_FORMAT_WEBM)
 
551
    format = "webm";
 
552
#endif
 
553
  GST_DEBUG_OBJECT (sink, "Connection format is: %s", format);
544
554
 
545
555
  if (shout_set_format (sink->conn, sink->audio_format) != SHOUTERR_SUCCESS)
546
556
    goto could_not_set_format;
810
820
    shout2send->audio_format = SHOUT_FORMAT_MP3;
811
821
  } else if (!strcmp (mimetype, "application/ogg")) {
812
822
    shout2send->audio_format = SHOUT_FORMAT_VORBIS;
 
823
#ifdef SHOUT_FORMAT_WEBM
 
824
  } else if (!strcmp (mimetype, "video/webm")) {
 
825
    shout2send->audio_format = SHOUT_FORMAT_WEBM;
 
826
#endif
813
827
  } else {
814
828
    ret = FALSE;
815
829
  }