Commit 220b24c7 authored by Rostislav Pehlivanov's avatar Rostislav Pehlivanov

lavc: remove libschroedinger encoding and decoding wrappers

The library has stopped being developed and Debian has removed it
from its repositories citing security issues.
The native Dirac decoder supports everything the library has and basic
encoding support is still provided via the native vc2 (Dirac Pro, intra
only version of Dirac) encoder. Hence, there's no reason to still support
linking to the library and potentially leading users into security issues.
parent a3deeaad
......@@ -15,6 +15,7 @@ version <next>:
- crossfeed audio filter
- spec compliant VP9 muxing support in MP4
- remove the libnut muxer/demuxer wrappers
- remove the libschroedinger encoder/decoder wrappers
version 3.3:
- CrystalHD decoder moved to new decode API
......
......@@ -192,7 +192,6 @@ Codecs:
libkvazaar.c Arttu Ylä-Outinen
libopenjpeg.c Jaikrishnan Menon
libopenjpegenc.c Michael Bradshaw
libschroedinger* David Conrad
libtheoraenc.c David Conrad
libvorbis.c David Conrad
libvpx* James Zern
......
......@@ -245,7 +245,6 @@ External library support:
--enable-librsvg enable SVG rasterization via librsvg [no]
--enable-librubberband enable rubberband needed for rubberband filter [no]
--enable-librtmp enable RTMP[E] support via librtmp [no]
--enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
--enable-libshine enable fixed-point MP3 encoding via libshine [no]
--enable-libsmbclient enable Samba protocol via libsmbclient [no]
--enable-libsnappy enable Snappy compression, needed for hap encoding [no]
......@@ -1559,7 +1558,6 @@ EXTERNAL_LIBRARY_LIST="
libpulse
librsvg
librtmp
libschroedinger
libshine
libsmbclient
libsnappy
......@@ -2874,8 +2872,6 @@ libopus_decoder_deps="libopus"
libopus_encoder_deps="libopus"
libopus_encoder_select="audio_frame_queue"
librsvg_decoder_deps="librsvg"
libschroedinger_decoder_deps="libschroedinger"
libschroedinger_encoder_deps="libschroedinger"
libshine_encoder_deps="libshine"
libshine_encoder_select="audio_frame_queue"
libspeex_decoder_deps="libspeex"
......@@ -5847,7 +5843,6 @@ enabled libpulse && require_pkg_config libpulse pulse/pulseaudio.h pa_c
enabled librsvg && require_pkg_config librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
enabled librubberband && require_pkg_config "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new
enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_buffer
enabled libsmbclient && { use_pkg_config smbclient libsmbclient.h smbc_init ||
require smbclient libsmbclient.h smbc_init -lsmbclient; }
......
......@@ -711,7 +711,7 @@ following image formats are supported:
@item DFA @tab @tab X
@tab Codec used in Chronomaster game.
@item Dirac @tab E @tab X
@tab supported through external library libschroedinger
@tab supported though the native vc2 (Dirac Pro) encoder
@item Deluxe Paint Animation @tab @tab X
@item DNxHD @tab X @tab X
@tab aka SMPTE VC3
......
......@@ -315,7 +315,7 @@ These library packages are only available from
@example
yasm, libSDL-devel, libgsm-devel, libmp3lame-devel,
libschroedinger1.0-devel, speex-devel, libtheora-devel, libxvidcore-devel
speex-devel, libtheora-devel, libxvidcore-devel
@end example
The recommendation for x264 is to build it from source, as it evolves too
......
......@@ -902,10 +902,6 @@ OBJS-$(CONFIG_LIBOPUS_DECODER) += libopusdec.o libopus.o \
vorbis_data.o
OBJS-$(CONFIG_LIBOPUS_ENCODER) += libopusenc.o libopus.o \
vorbis_data.o
OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o \
libschroedinger.o
OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER) += libschroedingerenc.o \
libschroedinger.o
OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o
OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o
OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o
......@@ -1025,7 +1021,6 @@ SKIPHEADERS += %_tablegen.h \
SKIPHEADERS-$(CONFIG_D3D11VA) += d3d11va.h dxva2_internal.h
SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h
SKIPHEADERS-$(CONFIG_JNI) += ffjni.h
SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h
SKIPHEADERS-$(CONFIG_LIBVPX) += libvpx.h
SKIPHEADERS-$(CONFIG_LIBWEBP_ENCODER) += libwebpenc_common.h
SKIPHEADERS-$(CONFIG_MEDIACODEC) += mediacodecdec_common.h mediacodec_surface.h mediacodec_wrapper.h mediacodec_sw_buffer.h
......
......@@ -617,7 +617,6 @@ static void register_all(void)
REGISTER_ENCDEC (LIBOPENJPEG, libopenjpeg);
REGISTER_ENCDEC (LIBOPUS, libopus);
REGISTER_DECODER(LIBRSVG, librsvg);
REGISTER_ENCDEC (LIBSCHROEDINGER, libschroedinger);
REGISTER_ENCODER(LIBSHINE, libshine);
REGISTER_ENCDEC (LIBSPEEX, libspeex);
REGISTER_ENCODER(LIBTHEORA, libtheora);
......
/*
* Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* function definitions common to libschroedinger decoder and encoder
*/
#include "libavutil/attributes.h"
#include "libavutil/mem.h"
#include "libschroedinger.h"
#include "internal.h"
static const SchroVideoFormatInfo ff_schro_video_format_info[] = {
{ 640, 480, 24000, 1001},
{ 176, 120, 15000, 1001},
{ 176, 144, 25, 2 },
{ 352, 240, 15000, 1001},
{ 352, 288, 25, 2 },
{ 704, 480, 15000, 1001},
{ 704, 576, 25, 2 },
{ 720, 480, 30000, 1001},
{ 720, 576, 25, 1 },
{ 1280, 720, 60000, 1001},
{ 1280, 720, 50, 1 },
{ 1920, 1080, 30000, 1001},
{ 1920, 1080, 25, 1 },
{ 1920, 1080, 60000, 1001},
{ 1920, 1080, 50, 1 },
{ 2048, 1080, 24, 1 },
{ 4096, 2160, 24, 1 },
};
static unsigned int get_video_format_idx(AVCodecContext *avctx)
{
unsigned int ret_idx = 0;
unsigned int idx;
unsigned int num_formats = sizeof(ff_schro_video_format_info) /
sizeof(ff_schro_video_format_info[0]);
for (idx = 1; idx < num_formats; ++idx) {
const SchroVideoFormatInfo *vf = &ff_schro_video_format_info[idx];
if (avctx->width == vf->width &&
avctx->height == vf->height) {
ret_idx = idx;
if (avctx->time_base.den == vf->frame_rate_num &&
avctx->time_base.num == vf->frame_rate_denom)
return idx;
}
}
return ret_idx;
}
av_cold void ff_schro_queue_init(FFSchroQueue *queue)
{
queue->p_head = queue->p_tail = NULL;
queue->size = 0;
}
void ff_schro_queue_free(FFSchroQueue *queue, void (*free_func)(void *))
{
while (queue->p_head)
free_func(ff_schro_queue_pop(queue));
}
int ff_schro_queue_push_back(FFSchroQueue *queue, void *p_data)
{
FFSchroQueueElement *p_new = av_mallocz(sizeof(FFSchroQueueElement));
if (!p_new)
return -1;
p_new->data = p_data;
if (!queue->p_head)
queue->p_head = p_new;
else
queue->p_tail->next = p_new;
queue->p_tail = p_new;
++queue->size;
return 0;
}
void *ff_schro_queue_pop(FFSchroQueue *queue)
{
FFSchroQueueElement *top = queue->p_head;
if (top) {
void *data = top->data;
queue->p_head = queue->p_head->next;
--queue->size;
av_freep(&top);
return data;
}
return NULL;
}
/**
* Schroedinger video preset table. Ensure that this tables matches up correctly
* with the ff_schro_video_format_info table.
*/
static const SchroVideoFormatEnum ff_schro_video_formats[]={
SCHRO_VIDEO_FORMAT_CUSTOM ,
SCHRO_VIDEO_FORMAT_QSIF ,
SCHRO_VIDEO_FORMAT_QCIF ,
SCHRO_VIDEO_FORMAT_SIF ,
SCHRO_VIDEO_FORMAT_CIF ,
SCHRO_VIDEO_FORMAT_4SIF ,
SCHRO_VIDEO_FORMAT_4CIF ,
SCHRO_VIDEO_FORMAT_SD480I_60 ,
SCHRO_VIDEO_FORMAT_SD576I_50 ,
SCHRO_VIDEO_FORMAT_HD720P_60 ,
SCHRO_VIDEO_FORMAT_HD720P_50 ,
SCHRO_VIDEO_FORMAT_HD1080I_60 ,
SCHRO_VIDEO_FORMAT_HD1080I_50 ,
SCHRO_VIDEO_FORMAT_HD1080P_60 ,
SCHRO_VIDEO_FORMAT_HD1080P_50 ,
SCHRO_VIDEO_FORMAT_DC2K_24 ,
SCHRO_VIDEO_FORMAT_DC4K_24 ,
};
SchroVideoFormatEnum ff_get_schro_video_format_preset(AVCodecContext *avctx)
{
unsigned int num_formats = sizeof(ff_schro_video_formats) /
sizeof(ff_schro_video_formats[0]);
unsigned int idx = get_video_format_idx(avctx);
return (idx < num_formats) ? ff_schro_video_formats[idx] :
SCHRO_VIDEO_FORMAT_CUSTOM;
}
int ff_get_schro_frame_format (SchroChromaFormat schro_pix_fmt,
SchroFrameFormat *schro_frame_fmt)
{
unsigned int num_formats = sizeof(schro_pixel_format_map) /
sizeof(schro_pixel_format_map[0]);
int idx;
for (idx = 0; idx < num_formats; ++idx) {
if (schro_pixel_format_map[idx].schro_pix_fmt == schro_pix_fmt) {
*schro_frame_fmt = schro_pixel_format_map[idx].schro_frame_fmt;
return 0;
}
}
return -1;
}
static void free_schro_frame(SchroFrame *frame, void *priv)
{
AVFrame *p_pic = priv;
av_frame_free(&p_pic);
}
SchroFrame *ff_create_schro_frame(AVCodecContext *avctx,
SchroFrameFormat schro_frame_fmt)
{
AVFrame *p_pic;
SchroFrame *p_frame;
int y_width, uv_width;
int y_height, uv_height;
int i;
y_width = avctx->width;
y_height = avctx->height;
uv_width = y_width >> (SCHRO_FRAME_FORMAT_H_SHIFT(schro_frame_fmt));
uv_height = y_height >> (SCHRO_FRAME_FORMAT_V_SHIFT(schro_frame_fmt));
p_pic = av_frame_alloc();
if (!p_pic)
return NULL;
if (ff_get_buffer(avctx, p_pic, AV_GET_BUFFER_FLAG_REF) < 0) {
av_frame_free(&p_pic);
return NULL;
}
p_frame = schro_frame_new();
p_frame->format = schro_frame_fmt;
p_frame->width = y_width;
p_frame->height = y_height;
schro_frame_set_free_callback(p_frame, free_schro_frame, p_pic);
for (i = 0; i < 3; ++i) {
p_frame->components[i].width = i ? uv_width : y_width;
p_frame->components[i].stride = p_pic->linesize[i];
p_frame->components[i].height = i ? uv_height : y_height;
p_frame->components[i].length =
p_frame->components[i].stride * p_frame->components[i].height;
p_frame->components[i].data = p_pic->data[i];
if (i) {
p_frame->components[i].v_shift =
SCHRO_FRAME_FORMAT_V_SHIFT(p_frame->format);
p_frame->components[i].h_shift =
SCHRO_FRAME_FORMAT_H_SHIFT(p_frame->format);
}
}
return p_frame;
}
/*
* Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* data structures common to libschroedinger decoder and encoder
*/
#ifndef AVCODEC_LIBSCHROEDINGER_H
#define AVCODEC_LIBSCHROEDINGER_H
#include <schroedinger/schrobitstream.h>
#include <schroedinger/schroframe.h>
#include "avcodec.h"
typedef struct SchroVideoFormatInfo {
uint16_t width;
uint16_t height;
uint16_t frame_rate_num;
uint16_t frame_rate_denom;
} SchroVideoFormatInfo;
/**
* contains a single encoded frame returned from Dirac or Schroedinger
*/
typedef struct FFSchroEncodedFrame {
/** encoded frame data */
uint8_t *p_encbuf;
/** encoded frame size */
uint32_t size;
/** encoded frame number. Will be used as pts */
uint32_t frame_num;
/** key frame flag. 1 : is key frame , 0 : in not key frame */
uint16_t key_frame;
} FFSchroEncodedFrame;
/**
* queue element
*/
typedef struct FFSchroQueueElement {
/** Data to be stored in queue*/
void *data;
/** Pointer to next element queue */
struct FFSchroQueueElement *next;
} FFSchroQueueElement;
/**
* A simple queue implementation used in libschroedinger
*/
typedef struct FFSchroQueue {
/** Pointer to head of queue */
FFSchroQueueElement *p_head;
/** Pointer to tail of queue */
FFSchroQueueElement *p_tail;
/** Queue size*/
int size;
} FFSchroQueue;
/**
* Initialise the queue
*/
void ff_schro_queue_init(FFSchroQueue *queue);
/**
* Add an element to the end of the queue
*/
int ff_schro_queue_push_back(FFSchroQueue *queue, void *p_data);
/**
* Return the first element in the queue
*/
void *ff_schro_queue_pop(FFSchroQueue *queue);
/**
* Free the queue resources. free_func is a function supplied by the caller to
* free any resources allocated by the caller. The data field of the queue
* element is passed to it.
*/
void ff_schro_queue_free(FFSchroQueue *queue, void (*free_func)(void *));
static const struct {
enum AVPixelFormat ff_pix_fmt;
SchroChromaFormat schro_pix_fmt;
SchroFrameFormat schro_frame_fmt;
} schro_pixel_format_map[] = {
{ AV_PIX_FMT_YUV420P, SCHRO_CHROMA_420, SCHRO_FRAME_FORMAT_U8_420 },
{ AV_PIX_FMT_YUV422P, SCHRO_CHROMA_422, SCHRO_FRAME_FORMAT_U8_422 },
{ AV_PIX_FMT_YUV444P, SCHRO_CHROMA_444, SCHRO_FRAME_FORMAT_U8_444 },
};
/**
* Returns the video format preset matching the input video dimensions and
* time base.
*/
SchroVideoFormatEnum ff_get_schro_video_format_preset (AVCodecContext *avctx);
/**
* Sets the Schroedinger frame format corresponding to the Schro chroma format
* passed. Returns 0 on success, -1 on failure.
*/
int ff_get_schro_frame_format(SchroChromaFormat schro_chroma_fmt,
SchroFrameFormat *schro_frame_fmt);
/**
* Create a Schro frame based on the dimensions and frame format
* passed. Returns a pointer to a frame on success, NULL on failure.
*/
SchroFrame *ff_create_schro_frame(AVCodecContext *avctx,
SchroFrameFormat schro_frame_fmt);
#endif /* AVCODEC_LIBSCHROEDINGER_H */
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment