Commit 7ed9ec03 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  dwt: Drop unused functions spatial_compose{53|97}i()
  nutdec: Remove unused and broken debug function stub
  avcodec: Drop long-deprecated imgconvert.h header
  Add Opus support to the Ogg muxer.
  Add Opus codec id and codec description.
  avformat: Identify anonymous AVIO typedef structs.

Conflicts:
	libavcodec/avcodec.h
	libavcodec/codec_desc.c
	libavcodec/imgconvert.h
	libavcodec/version.h
	libavformat/oggenc.c
	libavformat/version.h
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents ac7d0c79 4e5b7f31
......@@ -423,6 +423,7 @@ enum AVCodecID {
AV_CODEC_ID_RALF,
AV_CODEC_ID_IAC,
AV_CODEC_ID_ILBC,
AV_CODEC_ID_OPUS_DEPRECATED,
AV_CODEC_ID_FFWAVESYNTH = MKBETAG('F','F','W','S'),
AV_CODEC_ID_8SVX_RAW = MKBETAG('8','S','V','X'),
AV_CODEC_ID_SONIC = MKBETAG('S','O','N','C'),
......
......@@ -2242,7 +2242,8 @@ static const AVCodecDescriptor codec_descriptors[] = {
.id = AV_CODEC_ID_OPUS,
.type = AVMEDIA_TYPE_AUDIO,
.name = "opus",
.long_name = NULL_IF_CONFIG_SMALL("Opus"),
.long_name = NULL_IF_CONFIG_SMALL("Opus (Opus Interactive Audio Codec)"),
.props = AV_CODEC_PROP_LOSSY,
},
/* subtitle codecs */
......
......@@ -468,15 +468,6 @@ static void spatial_compose53i_dy(DWTCompose *cs, IDWTELEM *buffer,
cs->y += 2;
}
static void av_unused spatial_compose53i(IDWTELEM *buffer, IDWTELEM *temp,
int width, int height, int stride)
{
DWTCompose cs;
spatial_compose53i_init(&cs, buffer, height, stride);
while (cs.y <= height)
spatial_compose53i_dy(&cs, buffer, temp, width, height, stride);
}
void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width)
{
const int w2 = (width + 1) >> 1;
......@@ -651,15 +642,6 @@ static void spatial_compose97i_dy(DWTCompose *cs, IDWTELEM *buffer,
cs->y += 2;
}
static void av_unused spatial_compose97i(IDWTELEM *buffer, IDWTELEM *temp,
int width, int height, int stride)
{
DWTCompose cs;
spatial_compose97i_init(&cs, buffer, height, stride);
while (cs.y <= height)
spatial_compose97i_dy(&cs, buffer, temp, width, height, stride);
}
void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer *sb, int width,
int height, int stride_line, int type,
int decomposition_count)
......
......@@ -33,7 +33,6 @@
#include "avcodec.h"
#include "dsputil.h"
#include "internal.h"
#include "imgconvert.h"
#include "libavutil/colorspace.h"
#include "libavutil/common.h"
#include "libavutil/pixdesc.h"
......
/*
* Misc image conversion routines
* most functionality is exported to the public API, see avcodec.h
*
* Copyright (c) 2008 Vitor Sessak
*
* 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
*/
#ifndef AVCODEC_IMGCONVERT_H
#define AVCODEC_IMGCONVERT_H
#include <stdint.h>
#include "avcodec.h"
#if LIBAVCODEC_VERSION_MAJOR < 53
attribute_deprecated
int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width);
attribute_deprecated
int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt, int height);
attribute_deprecated
int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane);
attribute_deprecated
int ff_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt);
#endif
#endif /* AVCODEC_IMGCONVERT_H */
......@@ -25,7 +25,6 @@
*/
#include "avcodec.h"
#include "imgconvert.h"
#include "raw.h"
#include "libavutil/avassert.h"
#include "libavutil/common.h"
......
......@@ -38,7 +38,6 @@
#include "avcodec.h"
#include "dsputil.h"
#include "libavutil/opt.h"
#include "imgconvert.h"
#include "thread.h"
#include "frame_thread_encoder.h"
#include "audioconvert.h"
......@@ -1848,6 +1847,7 @@ static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id)
//This is for future deprecatec codec ids, its empty since
//last major bump but will fill up again over time, please don't remove it
// case AV_CODEC_ID_UTVIDEO_DEPRECATED: return AV_CODEC_ID_UTVIDEO;
case AV_CODEC_ID_OPUS_DEPRECATED: return AV_CODEC_ID_OPUS;
default : return id;
}
}
......
......@@ -27,7 +27,7 @@
*/
#define LIBAVCODEC_VERSION_MAJOR 54
#define LIBAVCODEC_VERSION_MINOR 59
#define LIBAVCODEC_VERSION_MINOR 60
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
......
......@@ -48,7 +48,7 @@
* new elements have been added after this struct in AVFormatContext
* or AVIOContext.
*/
typedef struct {
typedef struct AVIOInterruptCB {
int (*callback)(void*);
void *opaque;
} AVIOInterruptCB;
......@@ -65,7 +65,7 @@ typedef struct {
* when implementing custom I/O. Normally these are set to the
* function pointers specified in avio_alloc_context()
*/
typedef struct {
typedef struct AVIOContext {
/**
* A class for private options.
*
......
......@@ -349,6 +349,35 @@ static int ogg_build_speex_headers(AVCodecContext *avctx,
return 0;
}
#define OPUS_HEADER_SIZE 19
static int ogg_build_opus_headers(AVCodecContext *avctx,
OGGStreamContext *oggstream, int bitexact,
AVDictionary **m)
{
uint8_t *p;
if (avctx->extradata_size < OPUS_HEADER_SIZE)
return -1;
/* first packet: Opus header */
p = av_mallocz(avctx->extradata_size);
if (!p)
return AVERROR(ENOMEM);
oggstream->header[0] = p;
oggstream->header_len[0] = avctx->extradata_size;
bytestream_put_buffer(&p, avctx->extradata, avctx->extradata_size);
/* second packet: VorbisComment */
p = ogg_write_vorbiscomment(8, bitexact, &oggstream->header_len[1], m, 0);
if (!p)
return AVERROR(ENOMEM);
oggstream->header[1] = p;
bytestream_put_buffer(&p, "OpusTags", 8);
return 0;
}
static int ogg_write_header(AVFormatContext *s)
{
OGGStreamContext *oggstream;
......@@ -359,13 +388,18 @@ static int ogg_write_header(AVFormatContext *s)
unsigned serial_num = i;
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
if (st->codec->codec_id == AV_CODEC_ID_OPUS)
/* Opus requires a fixed 48kHz clock */
avpriv_set_pts_info(st, 64, 1, 48000);
else
avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
avpriv_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den);
if (st->codec->codec_id != AV_CODEC_ID_VORBIS &&
st->codec->codec_id != AV_CODEC_ID_THEORA &&
st->codec->codec_id != AV_CODEC_ID_SPEEX &&
st->codec->codec_id != AV_CODEC_ID_FLAC) {
st->codec->codec_id != AV_CODEC_ID_FLAC &&
st->codec->codec_id != AV_CODEC_ID_OPUS) {
av_log(s, AV_LOG_ERROR, "Unsupported codec id in stream %d\n", i);
return -1;
}
......@@ -407,6 +441,15 @@ static int ogg_write_header(AVFormatContext *s)
av_freep(&st->priv_data);
return err;
}
} else if (st->codec->codec_id == AV_CODEC_ID_OPUS) {
int err = ogg_build_opus_headers(st->codec, oggstream,
st->codec->flags & CODEC_FLAG_BITEXACT,
&s->metadata);
if (err) {
av_log(s, AV_LOG_ERROR, "Error writing Opus headers\n");
av_freep(&st->priv_data);
return err;
}
} else {
uint8_t *p;
const char *cstr = st->codec->codec_id == AV_CODEC_ID_VORBIS ? "vorbis" : "theora";
......@@ -503,7 +546,9 @@ static int ogg_write_packet(AVFormatContext *s, AVPacket *pkt)
pframe_count = 0;
}
granule = (oggstream->last_kf_pts<<oggstream->kfgshift) | pframe_count;
} else
} else if (st->codec->codec_id == AV_CODEC_ID_OPUS)
granule = pkt->pts + pkt->duration + av_rescale_q(st->codec->delay, (AVRational){ 1, st->codec->sample_rate }, st->time_base);
else
granule = pkt->pts + pkt->duration;
ret = ogg_buffer_data(s, st, pkt->data, pkt->size, granule, 0);
......@@ -531,7 +576,8 @@ static int ogg_write_trailer(AVFormatContext *s)
AVStream *st = s->streams[i];
OGGStreamContext *oggstream = st->priv_data;
if (st->codec->codec_id == AV_CODEC_ID_FLAC ||
st->codec->codec_id == AV_CODEC_ID_SPEEX) {
st->codec->codec_id == AV_CODEC_ID_SPEEX ||
st->codec->codec_id == AV_CODEC_ID_OPUS) {
av_freep(&oggstream->header[0]);
}
av_freep(&oggstream->header[1]);
......@@ -544,7 +590,7 @@ AVOutputFormat ff_ogg_muxer = {
.name = "ogg",
.long_name = NULL_IF_CONFIG_SMALL("Ogg"),
.mime_type = "application/ogg",
.extensions = "ogg,ogv,spx",
.extensions = "ogg,ogv,spx,opus",
.priv_data_size = sizeof(OGGContext),
.audio_codec = AV_CODEC_ID_FLAC,
.video_codec = AV_CODEC_ID_THEORA,
......
......@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 54
#define LIBAVFORMAT_VERSION_MINOR 29
#define LIBAVFORMAT_VERSION_MICRO 104
#define LIBAVFORMAT_VERSION_MICRO 105
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
......
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