gstffmpegcodecmap.c 6.64 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
/* GStreamer
 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#include <libavcodec/avcodec.h>
#include <gst/gst.h>

GstCaps *
gst_ffmpegcodec_codec_context_to_caps (AVCodecContext *context)
{
  switch (context->codec_id) {
    case CODEC_ID_NONE:
      return GST_CAPS_NEW ("ffmpeg_none",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_MPEG1VIDEO:
      return GST_CAPS_NEW ("ffmpeg_mpeg1video",
		           "video/mpeg",
			     "mpegversion",  GST_PROPS_INT (1),
			     "systemstream", GST_PROPS_BOOLEAN (FALSE)
			  );
      break;
    case CODEC_ID_H263:
      return GST_CAPS_NEW ("ffmpeg_h263",
		           "video/H263",
			   NULL);
      break;
    case CODEC_ID_RV10:
      return GST_CAPS_NEW ("ffmpeg_rv10",
		           "video/x-rv10",
			   NULL);
      break;
    case CODEC_ID_MP2:
      return GST_CAPS_NEW ("ffmpeg_mp2",
		           "audio/mp3",
			   NULL);
      break;
    case CODEC_ID_MP3LAME:
      return GST_CAPS_NEW ("ffmpeg_mp3",
		           "audio/mp3",
			   NULL);
      break;
    case CODEC_ID_VORBIS:
      return GST_CAPS_NEW ("ffmpeg_vorbis",
		           "application/x-ogg",
			   NULL);
      break;
    case CODEC_ID_AC3:
      return GST_CAPS_NEW ("ffmpeg_ac3",
		           "audio/ac3",
			   NULL);
      break;
    case CODEC_ID_MJPEG:
      return GST_CAPS_NEW ("ffmpeg_mjpeg",
		           "video/x-mjpeg",
			   NULL);
      break;
    case CODEC_ID_MPEG4:
      return GST_CAPS_NEW ("ffmpeg_mpeg4",
		           "video/avi",
			     "format",  GST_PROPS_STRING ("strf_vids"),
			      "fourcc",  GST_PROPS_FOURCC (context->fourcc),
			      "width",   GST_PROPS_INT (context->width),
			      "height",  GST_PROPS_INT (context->height)
			  );
      break;
    case CODEC_ID_RAWVIDEO:
      return GST_CAPS_NEW ("ffmpeg_rawvideo",
		           "video/raw",
			   NULL);
      break;
    case CODEC_ID_MSMPEG4V1:
      return GST_CAPS_NEW ("ffmpeg_msmpeg4v1",
		           "video/avi",
			     "format",  GST_PROPS_STRING ("strf_vids"),
			      "fourcc",  GST_PROPS_FOURCC (context->fourcc),
			      "width",   GST_PROPS_INT (context->width),
			      "height",  GST_PROPS_INT (context->height)
			  );
      break;
    case CODEC_ID_MSMPEG4V2:
      return GST_CAPS_NEW ("ffmpeg_msmpeg4v2",
		           "video/avi",
			     "format",  GST_PROPS_STRING ("strf_vids"),
			      "fourcc",  GST_PROPS_FOURCC (context->fourcc),
			      "width",   GST_PROPS_INT (context->width),
			      "height",  GST_PROPS_INT (context->height)
			  );
      break;
    case CODEC_ID_MSMPEG4V3:
      return GST_CAPS_NEW ("ffmpeg_msmpeg4v3",
		           "video/avi",
			     "format",  GST_PROPS_STRING ("strf_vids"),
			      "fourcc",  GST_PROPS_FOURCC (context->fourcc),
			      "width",   GST_PROPS_INT (context->width),
			      "height",  GST_PROPS_INT (context->height)
			  );
      break;
    case CODEC_ID_WMV1:
      return GST_CAPS_NEW ("ffmpeg_wmv1",
		           "video/avi",
			     "format",  GST_PROPS_STRING ("strf_vids"),
			      "fourcc",  GST_PROPS_FOURCC (GST_STR_FOURCC ("WMV1")),
			      "width",   GST_PROPS_INT (context->width),
			      "height",  GST_PROPS_INT (context->height)
			  );
      break;
    case CODEC_ID_WMV2:
      return GST_CAPS_NEW ("ffmpeg_wmv2",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_H263P:
      return GST_CAPS_NEW ("ffmpeg_h263p",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_H263I:
      return GST_CAPS_NEW ("ffmpeg_h263i",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_SVQ1:
      return GST_CAPS_NEW ("ffmpeg_svq1",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_DVVIDEO:
      return GST_CAPS_NEW ("ffmpeg_dvvideo",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_DVAUDIO: 
      return GST_CAPS_NEW ("ffmpeg_dvaudio",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_WMAV1:
      return GST_CAPS_NEW ("ffmpeg_wmav1",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_WMAV2:
      return GST_CAPS_NEW ("ffmpeg_wmav2",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_MACE3:
      return GST_CAPS_NEW ("ffmpeg_mace3",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_MACE6:
      return GST_CAPS_NEW ("ffmpeg_mace6",
		           "unkown/unkown",
			   NULL);
      break;
    /* various pcm "codecs" */
    case CODEC_ID_PCM_S16LE:
      return GST_CAPS_NEW ("ffmpeg_s16le",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_PCM_S16BE:
      return GST_CAPS_NEW ("ffmpeg_s16be",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_PCM_U16LE:
      return GST_CAPS_NEW ("ffmpeg_u16le",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_PCM_U16BE:
      return GST_CAPS_NEW ("ffmpeg_u16be",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_PCM_S8:
      return GST_CAPS_NEW ("ffmpeg_s8",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_PCM_U8:
      return GST_CAPS_NEW ("ffmpeg_u8",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_PCM_MULAW:
      return GST_CAPS_NEW ("ffmpeg_mulaw",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_PCM_ALAW:
      return GST_CAPS_NEW ("ffmpeg_alaw",
		           "unkown/unkown",
			   NULL);
      break;
    /* various adpcm codecs */
    case CODEC_ID_ADPCM_IMA_QT:
      return GST_CAPS_NEW ("ffmpeg_adpcm_ima_qt",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_ADPCM_IMA_WAV:
      return GST_CAPS_NEW ("ffmpeg_adpcm_ima_wav",
		           "unkown/unkown",
			   NULL);
      break;
    case CODEC_ID_ADPCM_MS:
      return GST_CAPS_NEW ("ffmpeg_adpcm_ms",
		           "unkown/unkown",
			   NULL);
      break;
    default:
      g_warning ("no caps found for codec id %d\n", context->codec_id);
      break;
  }

  return NULL;
}