Commit 964912ab authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master: (21 commits)
  Warn about avserver being broken.
  avconv: drop code for special handling of avserver streams.
  rawdec: don't set codec timebase.
  lavf doxy: add muxing stuff to lavf_encoding group
  lavf doxy: add demuxing stuff to lavf_decoding group
  lavf doxy: expand/reword metadata API doxy.
  lavf doxy: add installed headers to groups.
  lavf doxy: add avio groups into the lavf_io group.
  lavf doxy: rename lavf I/O group to lavf_io.
  lavf doxy: add metadata docs to the main lavf group
  ttadec: check channel count as read from extradata.
  Add CLJR encoding and decoding regression tests
  cljr: remove unused code
  flacdec: Support for tracks in cuesheet metadata block
  ptx: fix inverted check for sufficient data
  flac muxer: fix writing of file header and STREAMINFO header from extradata
  ptx: emit a warning on insufficient picture data
  utvideo: add fate tests covering all codec variants
  doc: update to refer to avconv
  doc: remove some stale entries from the faq
  ...

Conflicts:
	Changelog
	avconv.c
	doc/avconv.texi
	doc/faq.texi
	doc/ffplay.texi
	doc/ffprobe.texi
	doc/ffserver.texi
	libavcodec/avcodec.h
	libavcodec/cljr.c
	libavformat/avformat.h
	libavformat/riff.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents cdba9b61 2e87b4c5
...@@ -132,6 +132,7 @@ easier to use. The changes are: ...@@ -132,6 +132,7 @@ easier to use. The changes are:
- PCM format support in OMA demuxer - PCM format support in OMA demuxer
- CLJR encoder - CLJR encoder
- new option: -report - new option: -report
- Dxtory capture format decoder
version 0.8: version 0.8:
......
...@@ -3635,41 +3635,6 @@ static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata) ...@@ -3635,41 +3635,6 @@ static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata)
return 0; return 0;
} }
static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const char *filename)
{
int i, err;
AVFormatContext *ic = avformat_alloc_context();
ic->interrupt_callback = int_cb;
err = avformat_open_input(&ic, filename, NULL, NULL);
if (err < 0)
return err;
/* copy stream format */
for(i=0;i<ic->nb_streams;i++) {
AVStream *st;
OutputStream *ost;
AVCodec *codec;
codec = avcodec_find_encoder(ic->streams[i]->codec->codec_id);
ost = new_output_stream(o, s, codec->type);
st = ost->st;
// FIXME: a more elegant solution is needed
memcpy(st, ic->streams[i], sizeof(AVStream));
st->info = av_malloc(sizeof(*st->info));
memcpy(st->info, ic->streams[i]->info, sizeof(*st->info));
avcodec_copy_context(st->codec, ic->streams[i]->codec);
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy)
choose_sample_fmt(st, codec);
else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy)
choose_pixel_fmt(st, codec);
}
av_close_input_file(ic);
return 0;
}
static void opt_output_file(void *optctx, const char *filename) static void opt_output_file(void *optctx, const char *filename)
{ {
OptionsContext *o = optctx; OptionsContext *o = optctx;
...@@ -3691,16 +3656,7 @@ static void opt_output_file(void *optctx, const char *filename) ...@@ -3691,16 +3656,7 @@ static void opt_output_file(void *optctx, const char *filename)
file_oformat= oc->oformat; file_oformat= oc->oformat;
oc->interrupt_callback = int_cb; oc->interrupt_callback = int_cb;
if (!strcmp(file_oformat->name, "ffm") && if (!o->nb_stream_maps) {
av_strstart(filename, "http:", NULL)) {
/* special case for files sent to ffserver: we get the stream
parameters from ffserver */
int err = read_ffserver_streams(o, oc, filename);
if (err < 0) {
print_error(filename, err);
exit_program(1);
}
} else if (!o->nb_stream_maps) {
/* pick the "best" stream of each type */ /* pick the "best" stream of each type */
#define NEW_STREAM(type, index)\ #define NEW_STREAM(type, index)\
if (index >= 0) {\ if (index >= 0) {\
......
...@@ -259,7 +259,7 @@ Set the number of video frames to record. This is an alias for @code{-frames:v}. ...@@ -259,7 +259,7 @@ Set the number of video frames to record. This is an alias for @code{-frames:v}.
@item -r[:@var{stream_specifier}] @var{fps} (@emph{input/output,per-stream}) @item -r[:@var{stream_specifier}] @var{fps} (@emph{input/output,per-stream})
Set frame rate (Hz value, fraction or abbreviation), (default = 25). Set frame rate (Hz value, fraction or abbreviation), (default = 25).
@item -s[:@var{stream_specifier}] @var{size} (@emph{input/output,per-stream}) @item -s[:@var{stream_specifier}] @var{size} (@emph{input/output,per-stream})
Set frame size. The format is @samp{wxh} (ffserver default = 160x128, avconv default = same as source). Set frame size. The format is @samp{wxh} (default - same as source).
The following abbreviations are recognized: The following abbreviations are recognized:
@table @samp @table @samp
@item sqcif @item sqcif
...@@ -1029,6 +1029,7 @@ the input file in reverse order. ...@@ -1029,6 +1029,7 @@ the input file in reverse order.
@c man begin SEEALSO @c man begin SEEALSO
ffplay(1), ffprobe(1), ffserver(1) and the FFmpeg HTML documentation ffplay(1), ffprobe(1), ffserver(1) and the FFmpeg HTML documentation
@c man end @c man end
@c man begin AUTHORS @c man begin AUTHORS
......
This diff is collapsed.
...@@ -23,6 +23,7 @@ ffserver [options] ...@@ -23,6 +23,7 @@ ffserver [options]
@c man begin DESCRIPTION @c man begin DESCRIPTION
ffserver is a streaming server for both audio and video. It supports ffserver is a streaming server for both audio and video. It supports
several live feeds, streaming from files and time shifting on live feeds several live feeds, streaming from files and time shifting on live feeds
(you can seek to positions in the past on each live feed, provided you (you can seek to positions in the past on each live feed, provided you
specify a big enough feed storage in ffserver.conf). specify a big enough feed storage in ffserver.conf).
......
...@@ -471,6 +471,7 @@ following image formats are supported: ...@@ -471,6 +471,7 @@ following image formats are supported:
@item Duck TrueMotion 2.0 @tab @tab X @item Duck TrueMotion 2.0 @tab @tab X
@tab fourcc: TM20 @tab fourcc: TM20
@item DV (Digital Video) @tab X @tab X @item DV (Digital Video) @tab X @tab X
@item Dxtory capture format @tab @tab X
@item Feeble Files/ScummVM DXA @tab @tab X @item Feeble Files/ScummVM DXA @tab @tab X
@tab Codec originally used in Feeble Files game. @tab Codec originally used in Feeble Files game.
@item Electronic Arts CMV video @tab @tab X @item Electronic Arts CMV video @tab @tab X
......
...@@ -133,6 +133,7 @@ OBJS-$(CONFIG_DVDSUB_ENCODER) += dvdsubenc.o ...@@ -133,6 +133,7 @@ OBJS-$(CONFIG_DVDSUB_ENCODER) += dvdsubenc.o
OBJS-$(CONFIG_DVVIDEO_DECODER) += dv.o dvdata.o OBJS-$(CONFIG_DVVIDEO_DECODER) += dv.o dvdata.o
OBJS-$(CONFIG_DVVIDEO_ENCODER) += dv.o dvdata.o OBJS-$(CONFIG_DVVIDEO_ENCODER) += dv.o dvdata.o
OBJS-$(CONFIG_DXA_DECODER) += dxa.o OBJS-$(CONFIG_DXA_DECODER) += dxa.o
OBJS-$(CONFIG_DXTORY_DECODER) += dxtory.o
OBJS-$(CONFIG_EAC3_DECODER) += eac3dec.o eac3_data.o OBJS-$(CONFIG_EAC3_DECODER) += eac3dec.o eac3_data.o
OBJS-$(CONFIG_EAC3_ENCODER) += eac3enc.o ac3enc.o ac3enc_float.o \ OBJS-$(CONFIG_EAC3_ENCODER) += eac3enc.o ac3enc.o ac3enc_float.o \
ac3tab.o ac3.o kbdwin.o eac3_data.o ac3tab.o ac3.o kbdwin.o eac3_data.o
......
...@@ -99,6 +99,7 @@ void avcodec_register_all(void) ...@@ -99,6 +99,7 @@ void avcodec_register_all(void)
REGISTER_DECODER (DSICINVIDEO, dsicinvideo); REGISTER_DECODER (DSICINVIDEO, dsicinvideo);
REGISTER_ENCDEC (DVVIDEO, dvvideo); REGISTER_ENCDEC (DVVIDEO, dvvideo);
REGISTER_DECODER (DXA, dxa); REGISTER_DECODER (DXA, dxa);
REGISTER_DECODER (DXTORY, dxtory);
REGISTER_DECODER (EACMV, eacmv); REGISTER_DECODER (EACMV, eacmv);
REGISTER_DECODER (EAMAD, eamad); REGISTER_DECODER (EAMAD, eamad);
REGISTER_DECODER (EATGQ, eatgq); REGISTER_DECODER (EATGQ, eatgq);
......
...@@ -253,6 +253,7 @@ enum CodecID { ...@@ -253,6 +253,7 @@ enum CodecID {
CODEC_ID_UTVIDEO_DEPRECATED, CODEC_ID_UTVIDEO_DEPRECATED,
CODEC_ID_BMV_VIDEO, CODEC_ID_BMV_VIDEO,
CODEC_ID_VBLE, CODEC_ID_VBLE,
CODEC_ID_DXTORY,
CODEC_ID_UTVIDEO = 0x800, CODEC_ID_UTVIDEO = 0x800,
CODEC_ID_ESCAPE130 = MKBETAG('E','1','3','0'), CODEC_ID_ESCAPE130 = MKBETAG('E','1','3','0'),
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
typedef struct CLJRContext { typedef struct CLJRContext {
AVClass *avclass; AVClass *avclass;
AVCodecContext *avctx;
AVFrame picture; AVFrame picture;
int dither_type; int dither_type;
} CLJRContext; } CLJRContext;
...@@ -42,7 +41,6 @@ static av_cold int common_init(AVCodecContext *avctx) ...@@ -42,7 +41,6 @@ static av_cold int common_init(AVCodecContext *avctx)
avcodec_get_frame_defaults(&a->picture); avcodec_get_frame_defaults(&a->picture);
avctx->coded_frame = &a->picture; avctx->coded_frame = &a->picture;
a->avctx = avctx;
return 0; return 0;
} }
......
/*
* Dxtory decoder
*
* Copyright (c) 2011 Konstantin Shishkov
*
* This file is part of Libav.
*
* Libav 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.
*
* Libav 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avcodec.h"
#include "libavutil/intreadwrite.h"
static av_cold int decode_init(AVCodecContext *avctx)
{
avctx->pix_fmt = PIX_FMT_YUV420P;
avctx->coded_frame = avcodec_alloc_frame();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
return 0;
}
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
AVPacket *avpkt)
{
int h, w;
AVFrame *pic = avctx->coded_frame;
const uint8_t *src = avpkt->data;
uint8_t *Y1, *Y2, *U, *V;
int ret;
if (pic->data[0])
avctx->release_buffer(avctx, pic);
if (avpkt->size < avctx->width * avctx->height * 3 / 2 + 16) {
av_log(avctx, AV_LOG_ERROR, "packet too small\n");
return AVERROR_INVALIDDATA;
}
pic->reference = 0;
if ((ret = avctx->get_buffer(avctx, pic)) < 0)
return ret;
pic->pict_type = AV_PICTURE_TYPE_I;
pic->key_frame = 1;
if (AV_RL32(src) != 0x01000002) {
av_log_ask_for_sample(avctx, "Unknown frame header %X\n", AV_RL32(src));
return AVERROR_PATCHWELCOME;
}
src += 16;
Y1 = pic->data[0];
Y2 = pic->data[0] + pic->linesize[0];
U = pic->data[1];
V = pic->data[2];
for (h = 0; h < avctx->height; h += 2) {
for (w = 0; w < avctx->width; w += 2) {
AV_WN16A(Y1 + w, AV_RN16A(src));
AV_WN16A(Y2 + w, AV_RN16A(src + 2));
U[w >> 1] = src[4] + 0x80;
V[w >> 1] = src[5] + 0x80;
src += 6;
}
Y1 += pic->linesize[0] << 1;
Y2 += pic->linesize[0] << 1;
U += pic->linesize[1];
V += pic->linesize[2];
}
*data_size = sizeof(AVFrame);
*(AVFrame*)data = *pic;
return avpkt->size;
}
static av_cold int decode_close(AVCodecContext *avctx)
{
AVFrame *pic = avctx->coded_frame;
if (pic->data[0])
avctx->release_buffer(avctx, pic);
av_freep(&avctx->coded_frame);
return 0;
}
AVCodec ff_dxtory_decoder = {
.name = "dxtory",
.long_name = NULL_IF_CONFIG_SMALL("Dxtory"),
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_DXTORY,
.init = decode_init,
.close = decode_close,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
};
...@@ -84,9 +84,7 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size, ...@@ -84,9 +84,7 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
ptr = p->data[0]; ptr = p->data[0];
stride = p->linesize[0]; stride = p->linesize[0];
for (y=0; y<h; y++) { for (y = 0; y < h && buf_end - buf >= w * bytes_per_pixel; y++) {
if (buf_end - buf < w * bytes_per_pixel)
break;
#if HAVE_BIGENDIAN #if HAVE_BIGENDIAN
unsigned int x; unsigned int x;
for (x=0; x<w*bytes_per_pixel; x+=bytes_per_pixel) for (x=0; x<w*bytes_per_pixel; x+=bytes_per_pixel)
...@@ -101,6 +99,11 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size, ...@@ -101,6 +99,11 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
*picture = s->picture; *picture = s->picture;
*data_size = sizeof(AVPicture); *data_size = sizeof(AVPicture);
if (y < h) {
av_log(avctx, AV_LOG_WARNING, "incomplete packet\n");
return avpkt->size;
}
return offset + w*h*bytes_per_pixel; return offset + w*h*bytes_per_pixel;
} }
......
...@@ -233,6 +233,11 @@ static av_cold int tta_decode_init(AVCodecContext * avctx) ...@@ -233,6 +233,11 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
s->data_length = get_bits_long(&s->gb, 32); s->data_length = get_bits_long(&s->gb, 32);
skip_bits(&s->gb, 32); // CRC32 of header skip_bits(&s->gb, 32); // CRC32 of header
if (s->channels == 0) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid number of channels\n");
return AVERROR_INVALIDDATA;
}
switch(s->bps) { switch(s->bps) {
case 1: avctx->sample_fmt = AV_SAMPLE_FMT_U8; break; case 1: avctx->sample_fmt = AV_SAMPLE_FMT_U8; break;
case 2: case 2:
......
...@@ -21,6 +21,12 @@ ...@@ -21,6 +21,12 @@
#ifndef AVFORMAT_AVFORMAT_H #ifndef AVFORMAT_AVFORMAT_H
#define AVFORMAT_AVFORMAT_H #define AVFORMAT_AVFORMAT_H
/**
* @file
* @ingroup libavf
* Main libavformat public API header
*/
/** /**
* @defgroup libavf I/O and Muxing/Demuxing Library * @defgroup libavf I/O and Muxing/Demuxing Library
* @{ * @{
...@@ -33,7 +39,7 @@ ...@@ -33,7 +39,7 @@
* @{ * @{
* @} * @}
* *
* @defgroup lavf_proto I/O Read/Write * @defgroup lavf_io I/O Read/Write
* @{ * @{
* @} * @}
* *
...@@ -86,10 +92,17 @@ struct AVFormatContext; ...@@ -86,10 +92,17 @@ struct AVFormatContext;
/** /**
* @defgroup metadata_api Public Metadata API * @defgroup metadata_api Public Metadata API
* @{ * @{
* @ingroup libavf
* The metadata API allows libavformat to export metadata tags to a client * The metadata API allows libavformat to export metadata tags to a client
* application using a sequence of key/value pairs. Like all strings in FFmpeg, * application when demuxing. Conversely it allows a client application to
* metadata must be stored as UTF-8 encoded Unicode. Note that metadata * set metadata when muxing.
*
* Metadata is exported or set as pairs of key/value strings in the 'metadata'
* fields of the AVFormatContext, AVStream, AVChapter and AVProgram structs
* using the @ref lavu_dict "AVDictionary" API. Like all strings in FFmpeg,
* metadata is assumed to be UTF-8 encoded Unicode. Note that metadata
* exported by demuxers isn't checked to be valid UTF-8 in most cases. * exported by demuxers isn't checked to be valid UTF-8 in most cases.
*
* Important concepts to keep in mind: * Important concepts to keep in mind:
* - Keys are unique; there can never be 2 tags with the same key. This is * - Keys are unique; there can never be 2 tags with the same key. This is
* also meant semantically, i.e., a demuxer should not knowingly produce * also meant semantically, i.e., a demuxer should not knowingly produce
...@@ -313,6 +326,10 @@ typedef struct AVFormatParameters { ...@@ -313,6 +326,10 @@ typedef struct AVFormatParameters {
increasing timestamps, but they must increasing timestamps, but they must
still be monotonic */ still be monotonic */
/**
* @addtogroup lavf_encoding
* @{
*/
typedef struct AVOutputFormat { typedef struct AVOutputFormat {
const char *name; const char *name;
/** /**
...@@ -373,7 +390,14 @@ typedef struct AVOutputFormat { ...@@ -373,7 +390,14 @@ typedef struct AVOutputFormat {
/* private fields */ /* private fields */
struct AVOutputFormat *next; struct AVOutputFormat *next;
} AVOutputFormat; } AVOutputFormat;
/**
* @}
*/
/**
* @addtogroup lavf_decoding
* @{
*/
typedef struct AVInputFormat { typedef struct AVInputFormat {
/** /**
* A comma separated list of short names for the format. New names * A comma separated list of short names for the format. New names
...@@ -495,6 +519,9 @@ typedef struct AVInputFormat { ...@@ -495,6 +519,9 @@ typedef struct AVInputFormat {
/* private fields */ /* private fields */
struct AVInputFormat *next; struct AVInputFormat *next;
} AVInputFormat; } AVInputFormat;
/**
* @}
*/
enum AVStreamParseType { enum AVStreamParseType {
AVSTREAM_PARSE_NONE, AVSTREAM_PARSE_NONE,
...@@ -1281,7 +1308,46 @@ enum CodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int ...@@ -1281,7 +1308,46 @@ enum CodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int
*/ */
unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum CodecID id); unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum CodecID id);
/* media file input */ /**
* Allocate an AVFormatContext.
* avformat_free_context() can be used to free the context and everything
* allocated by the framework within it.
*/
AVFormatContext *avformat_alloc_context(void);
#if FF_API_ALLOC_OUTPUT_CONTEXT
/**
* @deprecated deprecated in favor of avformat_alloc_output_context2()
*/
attribute_deprecated
AVFormatContext *avformat_alloc_output_context(const char *format,
AVOutputFormat *oformat,
const char *filename);
#endif
/**
* Allocate an AVFormatContext for an output format.
* avformat_free_context() can be used to free the context and
* everything allocated by the framework within it.
*
* @param *ctx is set to the created format context, or to NULL in
* case of failure
* @param oformat format to use for allocating the context, if NULL
* format_name and filename are used instead
* @param format_name the name of output format to use for allocating the
* context, if NULL filename is used instead
* @param filename the name of the filename to use for allocating the
* context, may be NULL
* @return >= 0 in case of success, a negative AVERROR code in case of
* failure
*/
int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oformat,
const char *format_name, const char *filename);
/**
* @addtogroup lavf_decoding
* @{
*/
/** /**
* Find AVInputFormat based on the short name of the input format. * Find AVInputFormat based on the short name of the input format.
...@@ -1390,42 +1456,6 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputForma ...@@ -1390,42 +1456,6 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputForma
int av_demuxer_open(AVFormatContext *ic, AVFormatParameters *ap); int av_demuxer_open(AVFormatContext *ic, AVFormatParameters *ap);
/**
* Allocate an AVFormatContext.
* avformat_free_context() can be used to free the context and everything
* allocated by the framework within it.
*/
AVFormatContext *avformat_alloc_context(void);
#if FF_API_ALLOC_OUTPUT_CONTEXT
/**
* @deprecated deprecated in favor of avformat_alloc_output_context2()
*/
attribute_deprecated
AVFormatContext *avformat_alloc_output_context(const char *format,
AVOutputFormat *oformat,
const char *filename);
#endif
/**
* Allocate an AVFormatContext for an output format.
* avformat_free_context() can be used to free the context and
* everything allocated by the framework within it.
*
* @param *ctx is set to the created format context, or to NULL in
* case of failure
* @param oformat format to use for allocating the context, if NULL
* format_name and filename are used instead
* @param format_name the name of output format to use for allocating the
* context, if NULL filename is used instead
* @param filename the name of the filename to use for allocating the
* context, may be NULL
* @return >= 0 in case of success, a negative AVERROR code in case of
* failure
*/
int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oformat,
const char *format_name, const char *filename);
#if FF_API_FORMAT_PARAMETERS #if FF_API_FORMAT_PARAMETERS
/** /**
* Read packets of a media file to get stream information. This * Read packets of a media file to get stream information. This
...@@ -1617,6 +1647,9 @@ void av_close_input_stream(AVFormatContext *s); ...@@ -1617,6 +1647,9 @@ void av_close_input_stream(AVFormatContext *s);
* @param s media file handle * @param s media file handle
*/ */
void av_close_input_file(AVFormatContext *s); void av_close_input_file(AVFormatContext *s);
/**
* @}
*/
/** /**
* Free an AVFormatContext and all its streams. * Free an AVFormatContext and all its streams.
...@@ -1708,9 +1741,6 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, ...@@ -1708,9 +1741,6 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index,
int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t )); int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t ));
#endif #endif
/**
* media file output
*/
#if FF_API_FORMAT_PARAMETERS #if FF_API_FORMAT_PARAMETERS
/** /**
* @deprecated pass the options to avformat_write_header directly. * @deprecated pass the options to avformat_write_header directly.
...@@ -1743,7 +1773,10 @@ void av_url_split(char *proto, int proto_size, ...@@ -1743,7 +1773,10 @@ void av_url_split(char *proto, int proto_size,
int *port_ptr, int *port_ptr,
char *path, int path_size, char *path, int path_size,
const char *url); const char *url);
/**
* @addtogroup lavf_encoding
* @{
*/
/** /**
* Allocate the stream private data and write the stream header to * Allocate the stream private data and write the stream header to
* an output media file. * an output media file.
...@@ -1835,6 +1868,9 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, ...@@ -1835,6 +1868,9 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
* @return 0 if OK, AVERROR_xxx on error * @return 0 if OK, AVERROR_xxx on error
*/ */
int av_write_trailer(AVFormatContext *s); int av_write_trailer(AVFormatContext *s);
/**
* @}
*/
/** /**
* Get timing information for the data currently output. * Get timing information for the data currently output.
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
/** /**
* @file * @file
* @ingroup lavf_io
* Buffered I/O operations * Buffered I/O operations
*/ */
...@@ -211,6 +212,7 @@ extern URLInterruptCB *url_interrupt_cb; ...@@ -211,6 +212,7 @@ extern URLInterruptCB *url_interrupt_cb;
* @defgroup old_url_funcs Old url_* functions * @defgroup old_url_funcs Old url_* functions
* The following functions are deprecated. Use the buffered API based on #AVIOContext instead. * The following functions are deprecated. Use the buffered API based on #AVIOContext instead.
* @{ * @{
* @ingroup lavf_io
*/ */
attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol *up, attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol *up,
const char *url, int flags); const char *url, int flags);
...@@ -271,6 +273,7 @@ attribute_deprecated AVIOContext *av_alloc_put_byte( ...@@ -271,6 +273,7 @@ attribute_deprecated AVIOContext *av_alloc_put_byte(
* @defgroup old_avio_funcs Old put_/get_*() functions * @defgroup old_avio_funcs Old put_/get_*() functions
* The following functions are deprecated. Use the "avio_"-prefixed functions instead. * The following functions are deprecated. Use the "avio_"-prefixed functions instead.
* @{ * @{
* @ingroup lavf_io
*/ */
attribute_deprecated int get_buffer(AVIOContext *s, unsigned char *buf, int size); attribute_deprecated int get_buffer(AVIOContext *s, unsigned char *buf, int size);
attribute_deprecated int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size); attribute_deprecated int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size);
...@@ -308,6 +311,7 @@ attribute_deprecated int64_t av_url_read_fseek (AVIOContext *h, int stream_in ...@@ -308,6 +311,7 @@ attribute_deprecated int64_t av_url_read_fseek (AVIOContext *h, int stream_in
* @defgroup old_url_f_funcs Old url_f* functions * @defgroup old_url_f_funcs Old url_f* functions
* The following functions are deprecated, use the "avio_"-prefixed functions instead. * The following functions are deprecated, use the "avio_"-prefixed functions instead.
* @{ * @{
* @ingroup lavf_io
*/ */
attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags); attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags);
attribute_deprecated int url_fclose(AVIOContext *s); attribute_deprecated int url_fclose(AVIOContext *s);
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "rawdec.h" #include "rawdec.h"
#include "oggdec.h" #include "oggdec.h"
#include "vorbiscomment.h" #include "vorbiscomment.h"
#include "libavcodec/bytestream.h"
static int flac_read_header(AVFormatContext *s, static int flac_read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
...@@ -54,6 +55,7 @@ static int flac_read_header(AVFormatContext *s, ...@@ -54,6 +55,7 @@ static int flac_read_header(AVFormatContext *s,
switch (metadata_type) { switch (metadata_type) {
/* allocate and read metadata block for supported types */ /* allocate and read metadata block for supported types */
case FLAC_METADATA_TYPE_STREAMINFO: case FLAC_METADATA_TYPE_STREAMINFO:
case FLAC_METADATA_TYPE_CUESHEET:
case FLAC_METADATA_TYPE_VORBIS_COMMENT: case FLAC_METADATA_TYPE_VORBIS_COMMENT:
buffer = av_mallocz(metadata_size + FF_INPUT_BUFFER_PADDING_SIZE); buffer = av_mallocz(metadata_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!buffer) { if (!buffer) {
...@@ -96,6 +98,31 @@ static int flac_read_header(AVFormatContext *s, ...@@ -96,6 +98,31 @@ static int flac_read_header(AVFormatContext *s,
if (si.samples > 0) if (si.samples > 0)
st->duration = si.samples; st->duration = si.samples;
} }
} else if (metadata_type == FLAC_METADATA_TYPE_CUESHEET) {
uint8_t isrc[13];
uint64_t start;
const uint8_t *offset;
int i, j, chapters, track, ti;
if (metadata_size < 431)
return AVERROR_INVALIDDATA;
offset = buffer + 395;
chapters = bytestream_get_byte(&offset) - 1;
if (chapters <= 0)
return AVERROR_INVALIDDATA;
for (i = 0; i < chapters; i++) {
if (offset + 36 - buffer > metadata_size)
return AVERROR_INVALIDDATA;
start = bytestream_get_be64(&offset);
track = bytestream_get_byte(&offset);
bytestream_get_buffer(&offset, isrc, 12);
isrc[12] = 0;
offset += 14;
ti = bytestream_get_byte(&offset);
if (ti <= 0) return AVERROR_INVALIDDATA;
for (j = 0; j < ti; j++)
offset += 12;
avpriv_new_chapter(s, track, st->time_base, start, AV_NOPTS_VALUE, isrc);
}
} else { } else {
/* STREAMINFO must be the first block */ /* STREAMINFO must be the first block */
if (!found_streaminfo) { if (!found_streaminfo) {
......
...@@ -37,13 +37,11 @@ int ff_flac_write_header(AVIOContext *pb, AVCodecContext *codec, ...@@ -37,13 +37,11 @@ int ff_flac_write_header(AVIOContext *pb, AVCodecContext *codec,
if (!avpriv_flac_is_extradata_valid(codec, &format, &streaminfo)) if (!avpriv_flac_is_extradata_valid(codec, &format, &streaminfo))
return -1; return -1;
/* write "fLaC" stream marker and first metadata block header if needed */ /* write "fLaC" stream marker and first metadata block header */
if (format == FLAC_EXTRADATA_FORMAT_STREAMINFO) {
avio_write(pb, header, 8); avio_write(pb, header, 8);
}
/* write STREAMINFO or full header */ /* write STREAMINFO */
avio_write(pb, codec->extradata, codec->extradata_size); avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE);
return 0; return 0;
} }
...@@ -287,6 +287,7 @@ const AVCodecTag ff_codec_bmp_tags[] = { ...@@ -287,6 +287,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
{ CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '2') }, { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '2') },
{ CODEC_ID_VBLE, MKTAG('V', 'B', 'L', 'E') }, { CODEC_ID_VBLE, MKTAG('V', 'B', 'L', 'E') },
{ CODEC_ID_ESCAPE130, MKTAG('E', '1', '3', '0') }, { CODEC_ID_ESCAPE130, MKTAG('E', '1', '3', '0') },
{ CODEC_ID_DXTORY, MKTAG('x', 't', 'o', 'r') },
{ CODEC_ID_NONE, 0 } { CODEC_ID_NONE, 0 }
}; };
......
...@@ -21,6 +21,12 @@ ...@@ -21,6 +21,12 @@
#ifndef AVFORMAT_VERSION_H #ifndef AVFORMAT_VERSION_H
#define AVFORMAT_VERSION_H #define AVFORMAT_VERSION_H
/**
* @file
* @ingroup libavf
* Libavformat version macros
*/
#include "libavutil/avutil.h" #include "libavutil/avutil.h"
#define LIBAVFORMAT_VERSION_MAJOR 53 #define LIBAVFORMAT_VERSION_MAJOR 53
......
...@@ -19,6 +19,11 @@ if [ -n "$do_aref" ]; then ...@@ -19,6 +19,11 @@ if [ -n "$do_aref" ]; then
do_avconv $pcm_ref -b 128k -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav do_avconv $pcm_ref -b 128k -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav
fi fi
if [ -n "$do_cljr" ] ; then
do_video_encoding cljr.avi "-an -vcodec cljr"
do_video_decoding
fi
if [ -n "$do_mpeg" ] ; then if [ -n "$do_mpeg" ] ; then
# mpeg1 # mpeg1
do_video_encoding mpeg1.mpg "-qscale 10 -f mpeg1video" do_video_encoding mpeg1.mpg "-qscale 10 -f mpeg1video"
......
...@@ -241,3 +241,27 @@ fate-iirfilter: CMD = run libavcodec/iirfilter-test ...@@ -241,3 +241,27 @@ fate-iirfilter: CMD = run libavcodec/iirfilter-test
FATE_TESTS += fate-vble FATE_TESTS += fate-vble
fate-vble: CMD = framecrc -i $(SAMPLES)/vble/flowers-partial-2MB.avi fate-vble: CMD = framecrc -i $(SAMPLES)/vble/flowers-partial-2MB.avi
FATE_TESTS += fate-utvideo_rgba_left
fate-utvideo_rgba_left: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_rgba_left.avi
FATE_TESTS += fate-utvideo_rgba_median
fate-utvideo_rgba_median: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_rgba_median.avi
FATE_TESTS += fate-utvideo_rgb_left
fate-utvideo_rgb_left: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_rgb_left.avi
FATE_TESTS += fate-utvideo_rgb_median
fate-utvideo_rgb_median: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_rgb_median.avi
FATE_TESTS += fate-utvideo_yuv420_left
fate-utvideo_yuv420_left: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_yuv420_left.avi
FATE_TESTS += fate-utvideo_yuv420_median
fate-utvideo_yuv420_median: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_yuv420_median.avi
FATE_TESTS += fate-utvideo_yuv422_left
fate-utvideo_yuv422_left: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_yuv422_left.avi
FATE_TESTS += fate-utvideo_yuv422_median
fate-utvideo_yuv422_median: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_yuv422_median.avi
0, 0, 921600, 0x27e6001e
0, 3003, 921600, 0x7c0a92bc
0, 6006, 921600, 0x4d2be42c
0, 9009, 921600, 0x58ddd0be
0, 0, 921600, 0x9776611f
0, 3003, 921600, 0xdbfa64f4
0, 6006, 921600, 0xed2a0580
0, 9009, 921600, 0x6ecc80bc
0, 12012, 921600, 0x58ddd0be
0, 0, 1228800, 0xf1bc9432
0, 3003, 1228800, 0x8480d1e5
0, 6006, 1228800, 0xb01d5fb2
0, 9009, 1228800, 0x53cb42c4
0, 12012, 1228800, 0x2b2ea176
0, 0, 1228800, 0xf1bc9432
0, 3003, 1228800, 0x8480d1e5
0, 6006, 1228800, 0xb01d5fb2
0, 9009, 1228800, 0x53cb42c4
0, 12012, 1228800, 0x2b2ea176
0, 0, 460800, 0xece98fc8
0, 3003, 460800, 0x9baf786b
0, 6006, 460800, 0x8e8e0510
0, 9009, 460800, 0x27c1f2ba
0, 12012, 460800, 0x6a817987
0, 15015, 460800, 0x2f713ec2
0, 18018, 460800, 0x003b560e
0, 0, 460800, 0x6a817987
0, 3003, 460800, 0x2f713ec2
0, 6006, 460800, 0x003b560e
0, 9009, 460800, 0x9e1bbf63
0, 0, 614400, 0x9a6b8802
0, 3003, 614400, 0xaa8687e2
0, 6006, 614400, 0x2fe5bd40
0, 9009, 614400, 0x1c8f3737
0, 0, 614400, 0x9a6b8802
0, 3003, 614400, 0xaa8687e2
0, 6006, 614400, 0x2fe5bd40
0, 9009, 614400, 0x1c8f3737
ff4eebcd5bd7b6470f97867cdecb0bec *./tests/data/vsynth1/cljr.avi
5075660 ./tests/data/vsynth1/cljr.avi
0d473eb49653a05685178dd261de861c *./tests/data/cljr.vsynth1.out.yuv
stddev: 30.70 PSNR: 18.39 MAXDIFF: 255 bytes: 7603200/ 7603200
8ca3f24da468f32561100d3a1a71348d *./tests/data/vsynth2/cljr.avi
5075660 ./tests/data/vsynth2/cljr.avi
a0126ba9f2b2192b6b63b485e0118114 *./tests/data/cljr.vsynth2.out.yuv
stddev: 10.26 PSNR: 27.90 MAXDIFF: 62 bytes: 7603200/ 7603200
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