00001 /* 00002 * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com > 00003 * 00004 * This file is part of FFmpeg. 00005 * 00006 * FFmpeg is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * FFmpeg is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with FFmpeg; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00026 #include "libdirac_libschro.h" 00027 #include "libschroedinger.h" 00028 00033 static const SchroVideoFormatEnum ff_schro_video_formats[]={ 00034 SCHRO_VIDEO_FORMAT_CUSTOM , 00035 SCHRO_VIDEO_FORMAT_QSIF , 00036 SCHRO_VIDEO_FORMAT_QCIF , 00037 SCHRO_VIDEO_FORMAT_SIF , 00038 SCHRO_VIDEO_FORMAT_CIF , 00039 SCHRO_VIDEO_FORMAT_4SIF , 00040 SCHRO_VIDEO_FORMAT_4CIF , 00041 SCHRO_VIDEO_FORMAT_SD480I_60 , 00042 SCHRO_VIDEO_FORMAT_SD576I_50 , 00043 SCHRO_VIDEO_FORMAT_HD720P_60 , 00044 SCHRO_VIDEO_FORMAT_HD720P_50 , 00045 SCHRO_VIDEO_FORMAT_HD1080I_60 , 00046 SCHRO_VIDEO_FORMAT_HD1080I_50 , 00047 SCHRO_VIDEO_FORMAT_HD1080P_60 , 00048 SCHRO_VIDEO_FORMAT_HD1080P_50 , 00049 SCHRO_VIDEO_FORMAT_DC2K_24 , 00050 SCHRO_VIDEO_FORMAT_DC4K_24 , 00051 }; 00052 00053 SchroVideoFormatEnum ff_get_schro_video_format_preset(AVCodecContext *avccontext) 00054 { 00055 unsigned int num_formats = sizeof(ff_schro_video_formats) / 00056 sizeof(ff_schro_video_formats[0]); 00057 00058 unsigned int idx = ff_dirac_schro_get_video_format_idx (avccontext); 00059 00060 return (idx < num_formats) ? 00061 ff_schro_video_formats[idx] : SCHRO_VIDEO_FORMAT_CUSTOM; 00062 } 00063 00064 int ff_get_schro_frame_format (SchroChromaFormat schro_pix_fmt, 00065 SchroFrameFormat *schro_frame_fmt) 00066 { 00067 unsigned int num_formats = sizeof(ffmpeg_schro_pixel_format_map) / 00068 sizeof(ffmpeg_schro_pixel_format_map[0]); 00069 00070 int idx; 00071 00072 for (idx = 0; idx < num_formats; ++idx) { 00073 if (ffmpeg_schro_pixel_format_map[idx].schro_pix_fmt == schro_pix_fmt) { 00074 *schro_frame_fmt = 00075 ffmpeg_schro_pixel_format_map[idx].schro_frame_fmt; 00076 return 0; 00077 } 00078 } 00079 return -1; 00080 }