Commit 82db8ee3 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'fd41cb43'

* commit 'fd41cb43':
  avconv: improve sample format negotiation for decoder request
  Opus encoder using libopus
  mpegts: Drop pointless casting of hex_dump_debug arguments
  avformat: const correctness for av_hex_dump / av_hex_dump_log
  wmadec: Adjust debug printf argument length modifier

Conflicts:
	Changelog
	ffmpeg.c
	libavcodec/libopusdec.c
	libavcodec/version.h
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents f7f5370b fd41cb43
...@@ -4,6 +4,7 @@ releases are sorted from youngest to oldest. ...@@ -4,6 +4,7 @@ releases are sorted from youngest to oldest.
version next: version next:
- stream disposition information printing in ffprobe - stream disposition information printing in ffprobe
- filter for loudness analysis following EBU R128 - filter for loudness analysis following EBU R128
- Opus encoder using libopus
version 1.0: version 1.0:
......
...@@ -1768,6 +1768,7 @@ libopencore_amrwb_decoder_deps="libopencore_amrwb" ...@@ -1768,6 +1768,7 @@ libopencore_amrwb_decoder_deps="libopencore_amrwb"
libopenjpeg_decoder_deps="libopenjpeg" libopenjpeg_decoder_deps="libopenjpeg"
libopenjpeg_encoder_deps="libopenjpeg" libopenjpeg_encoder_deps="libopenjpeg"
libopus_decoder_deps="libopus" libopus_decoder_deps="libopus"
libopus_encoder_deps="libopus"
libschroedinger_decoder_deps="libschroedinger" libschroedinger_decoder_deps="libschroedinger"
libschroedinger_encoder_deps="libschroedinger" libschroedinger_encoder_deps="libschroedinger"
libspeex_decoder_deps="libspeex" libspeex_decoder_deps="libspeex"
......
...@@ -813,7 +813,7 @@ following image formats are supported: ...@@ -813,7 +813,7 @@ following image formats are supported:
@item Musepack SV7 @tab @tab X @item Musepack SV7 @tab @tab X
@item Musepack SV8 @tab @tab X @item Musepack SV8 @tab @tab X
@item Nellymoser Asao @tab X @tab X @item Nellymoser Asao @tab X @tab X
@item Opus @tab @tab E @item Opus @tab E @tab E
@tab supported through external library libopus @tab supported through external library libopus
@item PCM A-law @tab X @tab X @item PCM A-law @tab X @tab X
@item PCM mu-law @tab X @tab X @item PCM mu-law @tab X @tab X
......
...@@ -657,7 +657,10 @@ OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o \ ...@@ -657,7 +657,10 @@ OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o \
OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o
OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o
OBJS-$(CONFIG_LIBOPENJPEG_ENCODER) += libopenjpegenc.o OBJS-$(CONFIG_LIBOPENJPEG_ENCODER) += libopenjpegenc.o
OBJS-$(CONFIG_LIBOPUS_DECODER) += libopusdec.o vorbis_data.o OBJS-$(CONFIG_LIBOPUS_DECODER) += libopusdec.o libopus.o \
vorbis_data.o
OBJS-$(CONFIG_LIBOPUS_ENCODER) += libopusenc.o libopus.o \
vorbis_data.o audio_frame_queue.o
OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o \ OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o \
libschroedinger.o libschroedinger.o
OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER) += libschroedingerenc.o \ OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER) += libschroedingerenc.o \
......
...@@ -436,7 +436,7 @@ void avcodec_register_all(void) ...@@ -436,7 +436,7 @@ void avcodec_register_all(void)
REGISTER_ENCDEC (LIBOPENCORE_AMRNB, libopencore_amrnb); REGISTER_ENCDEC (LIBOPENCORE_AMRNB, libopencore_amrnb);
REGISTER_DECODER (LIBOPENCORE_AMRWB, libopencore_amrwb); REGISTER_DECODER (LIBOPENCORE_AMRWB, libopencore_amrwb);
REGISTER_ENCDEC (LIBOPENJPEG, libopenjpeg); REGISTER_ENCDEC (LIBOPENJPEG, libopenjpeg);
REGISTER_DECODER (LIBOPUS, libopus); REGISTER_ENCDEC (LIBOPUS, libopus);
REGISTER_ENCDEC (LIBSCHROEDINGER, libschroedinger); REGISTER_ENCDEC (LIBSCHROEDINGER, libschroedinger);
REGISTER_ENCDEC (LIBSPEEX, libspeex); REGISTER_ENCDEC (LIBSPEEX, libspeex);
REGISTER_DECODER (LIBSTAGEFRIGHT_H264, libstagefright_h264); REGISTER_DECODER (LIBSTAGEFRIGHT_H264, libstagefright_h264);
......
/*
* libopus encoder/decoder common code
* Copyright (c) 2012 Nicolas George
*
* 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
*/
#include <opus_defines.h>
#include "libavutil/common.h"
#include "libavutil/error.h"
#include "libopus.h"
int ff_opus_error_to_averror(int err)
{
switch (err) {
case OPUS_BAD_ARG:
return AVERROR(EINVAL);
case OPUS_BUFFER_TOO_SMALL:
return AVERROR_UNKNOWN;
case OPUS_INTERNAL_ERROR:
return AVERROR(EFAULT);
case OPUS_INVALID_PACKET:
return AVERROR_INVALIDDATA;
case OPUS_UNIMPLEMENTED:
return AVERROR(ENOSYS);
case OPUS_INVALID_STATE:
return AVERROR_UNKNOWN;
case OPUS_ALLOC_FAIL:
return AVERROR(ENOMEM);
default:
return AVERROR(EINVAL);
}
}
/*
* libopus encoder/decoder common code
* Copyright (c) 2012 Nicolas George
*
* 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_LIBOPUS_H
#define AVCODEC_LIBOPUS_H
int ff_opus_error_to_averror(int err);
#endif /* AVCODEC_LIBOPUS_H */
...@@ -22,13 +22,13 @@ ...@@ -22,13 +22,13 @@
#include <opus.h> #include <opus.h>
#include <opus_multistream.h> #include <opus_multistream.h>
#include "libavutil/common.h"
#include "libavutil/avassert.h" #include "libavutil/avassert.h"
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "avcodec.h" #include "avcodec.h"
#include "internal.h" #include "internal.h"
#include "vorbis.h" #include "vorbis.h"
#include "mathops.h" #include "mathops.h"
#include "libopus.h"
struct libopus_context { struct libopus_context {
OpusMSDecoder *dec; OpusMSDecoder *dec;
...@@ -39,20 +39,6 @@ struct libopus_context { ...@@ -39,20 +39,6 @@ struct libopus_context {
#endif #endif
}; };
static int opus_error_to_averror(int err)
{
switch (err) {
case OPUS_BAD_ARG: return AVERROR(EINVAL);
case OPUS_BUFFER_TOO_SMALL: return AVERROR_BUFFER_TOO_SMALL;
case OPUS_INTERNAL_ERROR: return AVERROR(EFAULT);
case OPUS_INVALID_PACKET: return AVERROR_INVALIDDATA;
case OPUS_UNIMPLEMENTED: return AVERROR(ENOSYS);
case OPUS_INVALID_STATE: return AVERROR_EXTERNAL;
case OPUS_ALLOC_FAIL: return AVERROR(ENOMEM);
default: return AVERROR(EINVAL);
}
}
#define OPUS_HEAD_SIZE 19 #define OPUS_HEAD_SIZE 19
static av_cold int libopus_decode_init(AVCodecContext *avc) static av_cold int libopus_decode_init(AVCodecContext *avc)
...@@ -105,7 +91,7 @@ static av_cold int libopus_decode_init(AVCodecContext *avc) ...@@ -105,7 +91,7 @@ static av_cold int libopus_decode_init(AVCodecContext *avc)
if (!opus->dec) { if (!opus->dec) {
av_log(avc, AV_LOG_ERROR, "Unable to create decoder: %s\n", av_log(avc, AV_LOG_ERROR, "Unable to create decoder: %s\n",
opus_strerror(ret)); opus_strerror(ret));
return opus_error_to_averror(ret); return ff_opus_error_to_averror(ret);
} }
#ifdef OPUS_SET_GAIN #ifdef OPUS_SET_GAIN
...@@ -165,7 +151,7 @@ static int libopus_decode(AVCodecContext *avc, void *frame, ...@@ -165,7 +151,7 @@ static int libopus_decode(AVCodecContext *avc, void *frame,
if (nb_samples < 0) { if (nb_samples < 0) {
av_log(avc, AV_LOG_ERROR, "Decoding error: %s\n", av_log(avc, AV_LOG_ERROR, "Decoding error: %s\n",
opus_strerror(nb_samples)); opus_strerror(nb_samples));
return opus_error_to_averror(nb_samples); return ff_opus_error_to_averror(nb_samples);
} }
#ifndef OPUS_SET_GAIN #ifndef OPUS_SET_GAIN
......
This diff is collapsed.
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "libavutil/avutil.h" #include "libavutil/avutil.h"
#define LIBAVCODEC_VERSION_MAJOR 54 #define LIBAVCODEC_VERSION_MAJOR 54
#define LIBAVCODEC_VERSION_MINOR 62 #define LIBAVCODEC_VERSION_MINOR 63
#define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
......
...@@ -926,7 +926,7 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data, ...@@ -926,7 +926,7 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
samples += s->nb_channels * s->frame_len; samples += s->nb_channels * s->frame_len;
} }
av_dlog(s->avctx, "%d %d %d %d outbytes:%d eaten:%d\n", av_dlog(s->avctx, "%d %d %d %d outbytes:%td eaten:%d\n",
s->frame_len_bits, s->block_len_bits, s->frame_len, s->block_len, s->frame_len_bits, s->block_len_bits, s->frame_len, s->block_len,
(int8_t *)samples - (int8_t *)data, s->block_align); (int8_t *)samples - (int8_t *)data, s->block_align);
......
...@@ -1813,7 +1813,7 @@ int av_get_output_timestamp(struct AVFormatContext *s, int stream, ...@@ -1813,7 +1813,7 @@ int av_get_output_timestamp(struct AVFormatContext *s, int stream,
* *
* @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2 * @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2
*/ */
void av_hex_dump(FILE *f, uint8_t *buf, int size); void av_hex_dump(FILE *f, const uint8_t *buf, int size);
/** /**
* Send a nice hexadecimal dump of a buffer to the log. * Send a nice hexadecimal dump of a buffer to the log.
...@@ -1827,7 +1827,7 @@ void av_hex_dump(FILE *f, uint8_t *buf, int size); ...@@ -1827,7 +1827,7 @@ void av_hex_dump(FILE *f, uint8_t *buf, int size);
* *
* @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2 * @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2
*/ */
void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size); void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size);
/** /**
* Send a nice dump of a packet to the specified file stream. * Send a nice dump of a packet to the specified file stream.
......
...@@ -1414,7 +1414,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len ...@@ -1414,7 +1414,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
int i; int i;
av_dlog(ts->stream, "PMT: len %i\n", section_len); av_dlog(ts->stream, "PMT: len %i\n", section_len);
hex_dump_debug(ts->stream, (uint8_t *)section, section_len); hex_dump_debug(ts->stream, section, section_len);
p_end = section + section_len - 4; p_end = section + section_len - 4;
p = section; p = section;
...@@ -1553,7 +1553,7 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len ...@@ -1553,7 +1553,7 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
AVProgram *program; AVProgram *program;
av_dlog(ts->stream, "PAT:\n"); av_dlog(ts->stream, "PAT:\n");
hex_dump_debug(ts->stream, (uint8_t *)section, section_len); hex_dump_debug(ts->stream, section, section_len);
p_end = section + section_len - 4; p_end = section + section_len - 4;
p = section; p = section;
...@@ -1601,7 +1601,7 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len ...@@ -1601,7 +1601,7 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
char *name, *provider_name; char *name, *provider_name;
av_dlog(ts->stream, "SDT:\n"); av_dlog(ts->stream, "SDT:\n");
hex_dump_debug(ts->stream, (uint8_t *)section, section_len); hex_dump_debug(ts->stream, section, section_len);
p_end = section + section_len - 4; p_end = section + section_len - 4;
p = section; p = section;
......
...@@ -4146,7 +4146,8 @@ int av_get_frame_filename(char *buf, int buf_size, ...@@ -4146,7 +4146,8 @@ int av_get_frame_filename(char *buf, int buf_size,
return -1; return -1;
} }
static void hex_dump_internal(void *avcl, FILE *f, int level, uint8_t *buf, int size) static void hex_dump_internal(void *avcl, FILE *f, int level,
const uint8_t *buf, int size)
{ {
int len, i, j, c; int len, i, j, c;
#undef fprintf #undef fprintf
...@@ -4175,12 +4176,12 @@ static void hex_dump_internal(void *avcl, FILE *f, int level, uint8_t *buf, int ...@@ -4175,12 +4176,12 @@ static void hex_dump_internal(void *avcl, FILE *f, int level, uint8_t *buf, int
#undef PRINT #undef PRINT
} }
void av_hex_dump(FILE *f, uint8_t *buf, int size) void av_hex_dump(FILE *f, const uint8_t *buf, int size)
{ {
hex_dump_internal(NULL, f, 0, buf, size); hex_dump_internal(NULL, f, 0, buf, size);
} }
void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size) void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
{ {
hex_dump_internal(avcl, NULL, level, buf, size); hex_dump_internal(avcl, NULL, level, buf, size);
} }
......
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