summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-04-14 03:21:38 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-04-14 03:21:38 +0200
commitc55780dcef1ba87564d8003cded7d045dce9ba34 (patch)
treef685b7150db1c7e0f5e65fb2761f3f8bd843f056
parentff5278d8f6203a9486c0cd63a3aecef4bc2e4f6f (diff)
parent651b276ef7ad8d89e89bfc94a4232ab6c36f3a8a (diff)
downloadffmpeg-c55780dcef1ba87564d8003cded7d045dce9ba34.tar.gz
Merge remote branch 'qatar/master'
* qatar/master: (32 commits) libopencore-amr, libvo-amrwbenc: Allow enabling DTX via private AVOptions libopencore-amr, libvo-amrwbenc: Only check the bitrate when changed libopencore-amr, libvo-amrwbenc: Find the closest matching bitrate libvo-*: Fix up the long codec names libavcodec: Mark AVCodec->priv_class const swscale: Factorize FAST_BGR2YV12 definition. libvo-aacenc: Only produce extradata if the global header flag is set lavf: postpone removal of public metadata conversion API lavc: postpone removal of request_channels lavc: postpone removal of audioconvert and sample_fmt wrappers lavf: postpone removal of deprecated avio functions libopencore-amr: Cosmetics: Rewrap and align libopencore-amr, libvo-amrbwenc: Rename variables and functions libopencore-amr: Convert commented out debug logging into av_dlog libopencore-amr: Remove an unused state variable libvo-amrwbenc: Don't explicitly store bitrate modes in the bitrate table libopencore-amr: Remove a useless local variable libopencore-amr, libvo-amrwbenc: Make the bitrate/mode mapping array static const libopencore-amr, libvo-amrwbenc: Return proper error codes in most places libopencore-amr: Don't print carriage returns in log messages ... Conflicts: doc/developer.texi libavcodec/avcodec.h libavcodec/libvo-aacenc.c libavcodec/libvo-amrwbenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--doc/APIchanges32
-rw-r--r--libavcodec/avcodec.h4
-rw-r--r--libavcodec/libopencore-amr.c155
-rw-r--r--libavcodec/libvo-aacenc.c20
-rw-r--r--libavcodec/libvo-amrwbenc.c79
-rw-r--r--libavcodec/msmpeg4.c3
-rw-r--r--libavcodec/version.h6
-rw-r--r--libavformat/applehttp.c11
-rw-r--r--libavformat/avformat.h4
-rw-r--r--libavformat/avio.c21
-rw-r--r--libavformat/avio.h33
-rw-r--r--libavformat/file.c16
-rw-r--r--libavformat/url.h1
-rw-r--r--libavformat/utils.c5
-rw-r--r--libavformat/version.h2
-rw-r--r--libswscale/rgb2rgb.c2
-rw-r--r--libswscale/swscale.c2
-rw-r--r--libswscale/swscale_internal.h2
-rw-r--r--tests/ref/fate/8bps2
-rw-r--r--tests/ref/fate/bethsoft-vid2
-rw-r--r--tests/ref/fate/bfi2
-rw-r--r--tests/ref/fate/corepng2
-rw-r--r--tests/ref/fate/creatureshock-avs2
-rw-r--r--tests/ref/fate/feeble-dxa2
-rw-r--r--tests/ref/fate/film-cvid-pcm-stereo-8bit16
-rw-r--r--tests/ref/fate/idroq-video-dpcm2
-rw-r--r--tests/ref/fate/interplay-mve-16bit2
-rw-r--r--tests/ref/fate/interplay-mve-8bit2
-rw-r--r--tests/ref/fate/lmlm4-demux2
-rw-r--r--tests/ref/fate/mtv2
-rw-r--r--tests/ref/fate/nuv2
-rw-r--r--tests/ref/fate/psx-str46
-rw-r--r--tests/ref/fate/sierra-vmd178
-rw-r--r--tests/ref/fate/siff6
-rw-r--r--tests/ref/fate/tiertex-seq144
-rw-r--r--tests/ref/fate/truemotion1-152
-rw-r--r--tests/ref/fate/truemotion1-242
-rw-r--r--tests/ref/fate/tscc-15bit30
-rw-r--r--tests/ref/fate/vqa-cc2
-rw-r--r--tests/ref/fate/wmv8-drm-nodec2
-rw-r--r--tests/ref/lavf/gxf2
-rw-r--r--tests/ref/lavf/mpg2
-rw-r--r--tests/ref/lavf/mxf2
43 files changed, 482 insertions, 374 deletions
diff --git a/doc/APIchanges b/doc/APIchanges
index e3be1f4858..e8d8ce26af 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -12,6 +12,38 @@ libavutil: 2009-03-08
API changes, most recent first:
+2011-04-12 - lavf 52.107.0 - avio.h
+ Avio cleanup, part II - deprecate the entire URLContext API:
+ 175389c add avio_check as a replacement for url_exist
+ ff1ec0c add avio_pause and avio_seek_time as replacements
+ for _av_url_read_fseek/fpause
+ cdc6a87 deprecate av_protocol_next(), avio_enum_protocols
+ should be used instead.
+ 80c6e23 rename url_set_interrupt_cb->avio_set_interrupt_cb.
+ f87b1b3 rename open flags: URL_* -> AVIO_*
+ f8270bb add avio_enum_protocols.
+ 5593f03 deprecate URLProtocol.
+ c486dad deprecate URLContext.
+ 026e175 deprecate the typedef for URLInterruptCB
+ 8e76a19 deprecate av_register_protocol2.
+ b840484 deprecate URL_PROTOCOL_FLAG_NESTED_SCHEME
+ 1305d93 deprecate av_url_read_seek
+ fa104e1 deprecate av_url_read_pause
+ 727c7aa deprecate url_get_filename().
+ 5958df3 deprecate url_max_packet_size().
+ 1869ea0 deprecate url_get_file_handle().
+ 32a97d4 deprecate url_filesize().
+ e52a914 deprecate url_close().
+ 58a48c6 deprecate url_seek().
+ 925e908 deprecate url_write().
+ dce3756 deprecate url_read_complete().
+ bc371ac deprecate url_read().
+ 0589da0 deprecate url_open().
+ 62eaaea deprecate url_connect.
+ 5652bb9 deprecate url_alloc.
+ 333e894 deprecate url_open_protocol
+ e230705 deprecate url_poll and URLPollEntry
+
2011-04-10 - lavu 50.40.0 - pixfmt.h
Add PIX_FMT_BGR48LE and PIX_FMT_BGR48BE pixel formats
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index f3d255c75e..0bb11c1bf3 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2966,9 +2966,7 @@ typedef struct AVCodec {
const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
const int64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
-
- AVClass *priv_class; ///< AVClass for the private context
-
+ const AVClass *priv_class; ///< AVClass for the private context
const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
/**
diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c
index b2e2f1632e..73abd758a1 100644
--- a/libavcodec/libopencore-amr.c
+++ b/libavcodec/libopencore-amr.c
@@ -20,6 +20,8 @@
*/
#include "avcodec.h"
+#include "libavutil/avstring.h"
+#include "libavutil/opt.h"
static void amr_decode_fix_avctx(AVCodecContext *avctx)
{
@@ -40,9 +42,6 @@ static void amr_decode_fix_avctx(AVCodecContext *avctx)
#include <opencore-amrnb/interf_dec.h>
#include <opencore-amrnb/interf_enc.h>
-static const char nb_bitrate_unsupported[] =
- "bitrate not supported: use one of 4.75k, 5.15k, 5.9k, 6.7k, 7.4k, 7.95k, 10.2k or 12.2k\n";
-
/* Common code for fixed and float version*/
typedef struct AMR_bitrates {
int rate;
@@ -50,41 +49,61 @@ typedef struct AMR_bitrates {
} AMR_bitrates;
/* Match desired bitrate */
-static int getBitrateMode(int bitrate)
+static int get_bitrate_mode(int bitrate, void *log_ctx)
{
/* make the correspondance between bitrate and mode */
- AMR_bitrates rates[] = { { 4750, MR475},
- { 5150, MR515},
- { 5900, MR59},
- { 6700, MR67},
- { 7400, MR74},
- { 7950, MR795},
- {10200, MR102},
- {12200, MR122}, };
- int i;
-
- for (i = 0; i < 8; i++)
+ static const AMR_bitrates rates[] = {
+ { 4750, MR475 }, { 5150, MR515 }, { 5900, MR59 }, { 6700, MR67 },
+ { 7400, MR74 }, { 7950, MR795 }, { 10200, MR102 }, { 12200, MR122 }
+ };
+ int i, best = -1, min_diff = 0;
+ char log_buf[200];
+
+ for (i = 0; i < 8; i++) {
if (rates[i].rate == bitrate)
return rates[i].mode;
- /* no bitrate matching, return an error */
- return -1;
+ if (best < 0 || abs(rates[i].rate - bitrate) < min_diff) {
+ best = i;
+ min_diff = abs(rates[i].rate - bitrate);
+ }
+ }
+ /* no bitrate matching exactly, log a warning */
+ snprintf(log_buf, sizeof(log_buf), "bitrate not supported: use one of ");
+ for (i = 0; i < 8; i++)
+ av_strlcatf(log_buf, sizeof(log_buf), "%.2fk, ", rates[i].rate / 1000.f);
+ av_strlcatf(log_buf, sizeof(log_buf), "using %.2fk", rates[best].rate / 1000.f);
+ av_log(log_ctx, AV_LOG_WARNING, "%s\n", log_buf);
+
+ return best;
}
typedef struct AMRContext {
- int frameCount;
- void *decState;
- int *enstate;
+ AVClass *av_class;
+ int frame_count;
+ void *dec_state;
+ void *enc_state;
int enc_bitrate;
+ int enc_mode;
+ int enc_dtx;
} AMRContext;
+static const AVOption options[] = {
+ { "dtx", "Allow DTX (generate comfort noise)", offsetof(AMRContext, enc_dtx), FF_OPT_TYPE_INT, 0, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+ { NULL }
+};
+
+static const AVClass class = {
+ "libopencore_amrnb", av_default_item_name, options, LIBAVUTIL_VERSION_INT
+};
+
static av_cold int amr_nb_decode_init(AVCodecContext *avctx)
{
- AMRContext *s = avctx->priv_data;
+ AMRContext *s = avctx->priv_data;
- s->frameCount = 0;
- s->decState = Decoder_Interface_init();
- if (!s->decState) {
- av_log(avctx, AV_LOG_ERROR, "Decoder_Interface_init error\r\n");
+ s->frame_count = 0;
+ s->dec_state = Decoder_Interface_init();
+ if (!s->dec_state) {
+ av_log(avctx, AV_LOG_ERROR, "Decoder_Interface_init error\n");
return -1;
}
@@ -92,7 +111,7 @@ static av_cold int amr_nb_decode_init(AVCodecContext *avctx)
if (avctx->channels > 1) {
av_log(avctx, AV_LOG_ERROR, "amr_nb: multichannel decoding not supported\n");
- return -1;
+ return AVERROR(ENOSYS);
}
return 0;
@@ -102,7 +121,7 @@ static av_cold int amr_nb_decode_close(AVCodecContext *avctx)
{
AMRContext *s = avctx->priv_data;
- Decoder_Interface_exit(s->decState);
+ Decoder_Interface_exit(s->dec_state);
return 0;
}
@@ -111,29 +130,28 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data,
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
- AMRContext *s = avctx->priv_data;
- const uint8_t *amrData = buf;
+ AMRContext *s = avctx->priv_data;
static const uint8_t block_size[16] = { 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0 };
enum Mode dec_mode;
int packet_size;
- /* av_log(NULL, AV_LOG_DEBUG, "amr_decode_frame buf=%p buf_size=%d frameCount=%d!!\n",
- buf, buf_size, s->frameCount); */
+ av_dlog(avctx, "amr_decode_frame buf=%p buf_size=%d frame_count=%d!!\n",
+ buf, buf_size, s->frame_count);
- dec_mode = (buf[0] >> 3) & 0x000F;
+ dec_mode = (buf[0] >> 3) & 0x000F;
packet_size = block_size[dec_mode] + 1;
if (packet_size > buf_size) {
av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n",
buf_size, packet_size);
- return -1;
+ return AVERROR_INVALIDDATA;
}
- s->frameCount++;
- /* av_log(NULL, AV_LOG_DEBUG, "packet_size=%d amrData= 0x%X %X %X %X\n",
- packet_size, amrData[0], amrData[1], amrData[2], amrData[3]); */
+ s->frame_count++;
+ av_dlog(avctx, "packet_size=%d buf= 0x%X %X %X %X\n",
+ packet_size, buf[0], buf[1], buf[2], buf[3]);
/* call decoder */
- Decoder_Interface_Decode(s->decState, amrData, data, 0);
+ Decoder_Interface_Decode(s->dec_state, buf, data, 0);
*data_size = 160 * 2;
return packet_size;
@@ -155,31 +173,29 @@ static av_cold int amr_nb_encode_init(AVCodecContext *avctx)
{
AMRContext *s = avctx->priv_data;
- s->frameCount = 0;
+ s->frame_count = 0;
if (avctx->sample_rate != 8000) {
av_log(avctx, AV_LOG_ERROR, "Only 8000Hz sample rate supported\n");
- return -1;
+ return AVERROR(ENOSYS);
}
if (avctx->channels != 1) {
av_log(avctx, AV_LOG_ERROR, "Only mono supported\n");
- return -1;
+ return AVERROR(ENOSYS);
}
avctx->frame_size = 160;
avctx->coded_frame = avcodec_alloc_frame();
- s->enstate=Encoder_Interface_init(0);
- if (!s->enstate) {
+ s->enc_state = Encoder_Interface_init(s->enc_dtx);
+ if (!s->enc_state) {
av_log(avctx, AV_LOG_ERROR, "Encoder_Interface_init error\n");
return -1;
}
- if ((s->enc_bitrate = getBitrateMode(avctx->bit_rate)) < 0) {
- av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported);
- return -1;
- }
+ s->enc_mode = get_bitrate_mode(avctx->bit_rate, avctx);
+ s->enc_bitrate = avctx->bit_rate;
return 0;
}
@@ -188,7 +204,7 @@ static av_cold int amr_nb_encode_close(AVCodecContext *avctx)
{
AMRContext *s = avctx->priv_data;
- Encoder_Interface_exit(s->enstate);
+ Encoder_Interface_exit(s->enc_state);
av_freep(&avctx->coded_frame);
return 0;
}
@@ -200,15 +216,15 @@ static int amr_nb_encode_frame(AVCodecContext *avctx,
AMRContext *s = avctx->priv_data;
int written;
- if ((s->enc_bitrate = getBitrateMode(avctx->bit_rate)) < 0) {
- av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported);
- return -1;
+ if (s->enc_bitrate != avctx->bit_rate) {
+ s->enc_mode = get_bitrate_mode(avctx->bit_rate, avctx);
+ s->enc_bitrate = avctx->bit_rate;
}
- written = Encoder_Interface_Encode(s->enstate, s->enc_bitrate, data,
+ written = Encoder_Interface_Encode(s->enc_state, s->enc_mode, data,
frame, 0);
- /* av_log(NULL, AV_LOG_DEBUG, "amr_nb_encode_frame encoded %u bytes, bitrate %u, first byte was %#02x\n",
- written, s->enc_bitrate, frame[0] ); */
+ av_dlog(avctx, "amr_nb_encode_frame encoded %u bytes, bitrate %u, first byte was %#02x\n",
+ written, s->enc_mode, frame[0]);
return written;
}
@@ -224,6 +240,7 @@ AVCodec ff_libopencore_amrnb_encoder = {
NULL,
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("OpenCORE Adaptive Multi-Rate (AMR) Narrow-Band"),
+ .priv_class = &class,
};
#endif
@@ -231,42 +248,24 @@ AVCodec ff_libopencore_amrnb_encoder = {
/* -----------AMR wideband ------------*/
#if CONFIG_LIBOPENCORE_AMRWB
-#ifdef _TYPEDEF_H
-//To avoid duplicate typedefs from typedef in amr-nb
-#define typedef_h
-#endif
-
#include <opencore-amrwb/dec_if.h>
#include <opencore-amrwb/if_rom.h>
-static const char wb_bitrate_unsupported[] =
- "bitrate not supported: use one of 6.6k, 8.85k, 12.65k, 14.25k, 15.85k, 18.25k, 19.85k, 23.05k, or 23.85k\n";
-
-/* Common code for fixed and float version*/
-typedef struct AMRWB_bitrates {
- int rate;
- int mode;
-} AMRWB_bitrates;
-
typedef struct AMRWBContext {
- int frameCount;
void *state;
- int mode;
- Word16 allow_dtx;
} AMRWBContext;
static av_cold int amr_wb_decode_init(AVCodecContext *avctx)
{
AMRWBContext *s = avctx->priv_data;
- s->frameCount = 0;
- s->state = D_IF_init();
+ s->state = D_IF_init();
amr_decode_fix_avctx(avctx);
if (avctx->channels > 1) {
av_log(avctx, AV_LOG_ERROR, "amr_wb: multichannel decoding not supported\n");
- return -1;
+ return AVERROR(ENOSYS);
}
return 0;
@@ -277,8 +276,7 @@ static int amr_wb_decode_frame(AVCodecContext *avctx, void *data,
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
- AMRWBContext *s = avctx->priv_data;
- const uint8_t *amrData = buf;
+ AMRWBContext *s = avctx->priv_data;
int mode;
int packet_size;
static const uint8_t block_size[16] = {18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1};
@@ -287,17 +285,16 @@ static int amr_wb_decode_frame(AVCodecContext *avctx, void *data,
/* nothing to do */
return 0;
- mode = (amrData[0] >> 3) & 0x000F;
+ mode = (buf[0] >> 3) & 0x000F;
packet_size = block_size[mode];
if (packet_size > buf_size) {
av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n",
buf_size, packet_size + 1);
- return -1;
+ return AVERROR_INVALIDDATA;
}
- s->frameCount++;
- D_IF_decode(s->state, amrData, data, _good_frame);
+ D_IF_decode(s->state, buf, data, _good_frame);
*data_size = 320 * 2;
return packet_size;
}
diff --git a/libavcodec/libvo-aacenc.c b/libavcodec/libvo-aacenc.c
index 026edd4213..f2a19a1814 100644
--- a/libavcodec/libvo-aacenc.c
+++ b/libavcodec/libvo-aacenc.c
@@ -62,12 +62,6 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
return AVERROR_UNKNOWN;
}
- avctx->extradata_size = 2;
- avctx->extradata = av_mallocz(avctx->extradata_size +
- FF_INPUT_BUFFER_PADDING_SIZE);
- if (!avctx->extradata)
- return AVERROR(ENOMEM);
-
for (index = 0; index < 16; index++)
if (avctx->sample_rate == ff_mpeg4audio_sample_rates[index])
break;
@@ -76,8 +70,16 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
avctx->sample_rate);
return AVERROR_NOTSUPP;
}
- avctx->extradata[0] = 0x02 << 3 | index >> 1;
- avctx->extradata[1] = (index & 0x01) << 7 | avctx->channels << 3;
+ if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
+ avctx->extradata_size = 2;
+ avctx->extradata = av_mallocz(avctx->extradata_size +
+ FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!avctx->extradata)
+ return AVERROR(ENOMEM);
+
+ avctx->extradata[0] = 0x02 << 3 | index >> 1;
+ avctx->extradata[1] = (index & 0x01) << 7 | avctx->channels << 3;
+ }
return 0;
}
@@ -123,6 +125,6 @@ AVCodec ff_libvo_aacenc_encoder = {
aac_encode_close,
NULL,
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("VisualOn libvo-aacenc AAC"),
+ .long_name = NULL_IF_CONFIG_SMALL("Android VisualOn AAC"),
};
diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c
index 114ed8408e..d8a6099561 100644
--- a/libavcodec/libvo-amrwbenc.c
+++ b/libavcodec/libvo-amrwbenc.c
@@ -22,41 +22,50 @@
#include <vo-amrwbenc/enc_if.h>
#include "avcodec.h"
-
-static const char wb_bitrate_unsupported[] =
- "bitrate not supported: use one of 6.6k, 8.85k, 12.65k, 14.25k, 15.85k, "
- "18.25k, 19.85k, 23.05k, or 23.85k\n";
-
-typedef struct AMRWB_bitrates {
- int rate;
- int mode;
-} AMRWB_bitrates;
+#include "libavutil/avstring.h"
+#include "libavutil/opt.h"
typedef struct AMRWBContext {
+ AVClass *av_class;
void *state;
int mode;
+ int last_bitrate;
int allow_dtx;
} AMRWBContext;
-static int getWBBitrateMode(int bitrate)
+static const AVOption options[] = {
+ { "dtx", "Allow DTX (generate comfort noise)", offsetof(AMRWBContext, allow_dtx), FF_OPT_TYPE_INT, 0, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+ { NULL }
+};
+
+static const AVClass class = {
+ "libvo_amrwbenc", av_default_item_name, options, LIBAVUTIL_VERSION_INT
+};
+
+static int get_wb_bitrate_mode(int bitrate, void *log_ctx)
{
/* make the correspondance between bitrate and mode */
- AMRWB_bitrates rates[] = { { 6600, 0},
- { 8850, 1},
- {12650, 2},
- {14250, 3},
- {15850, 4},
- {18250, 5},
- {19850, 6},
- {23050, 7},
- {23850, 8}, };
- int i;
-
+ static const int rates[] = { 6600, 8850, 12650, 14250, 15850, 18250,
+ 19850, 23050, 23850 };
+ int i, best = -1, min_diff = 0;
+ char log_buf[200];
+
+ for (i = 0; i < 9; i++) {
+ if (rates[i] == bitrate)
+ return i;
+ if (best < 0 || abs(rates[i] - bitrate) < min_diff) {
+ best = i;
+ min_diff = abs(rates[i] - bitrate);
+ }
+ }
+ /* no bitrate matching exactly, log a warning */
+ snprintf(log_buf, sizeof(log_buf), "bitrate not supported: use one of ");
for (i = 0; i < 9; i++)
- if (rates[i].rate == bitrate)
- return rates[i].mode;
- /* no bitrate matching, return an error */
- return -1;
+ av_strlcatf(log_buf, sizeof(log_buf), "%.2fk, ", rates[i] / 1000.f);
+ av_strlcatf(log_buf, sizeof(log_buf), "using %.2fk", rates[best] / 1000.f);
+ av_log(log_ctx, AV_LOG_WARNING, "%s\n", log_buf);
+
+ return best;
}
static av_cold int amr_wb_encode_init(AVCodecContext *avctx)
@@ -65,24 +74,21 @@ static av_cold int amr_wb_encode_init(AVCodecContext *avctx)
if (avctx->sample_rate != 16000) {
av_log(avctx, AV_LOG_ERROR, "Only 16000Hz sample rate supported\n");
- return -1;
+ return AVERROR(ENOSYS);
}
if (avctx->channels != 1) {
av_log(avctx, AV_LOG_ERROR, "Only mono supported\n");
- return -1;
+ return AVERROR(ENOSYS);
}
- if ((s->mode = getWBBitrateMode(avctx->bit_rate)) < 0) {
- av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported);
- return -1;
- }
+ s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx);
+ s->last_bitrate = avctx->bit_rate;
avctx->frame_size = 320;
avctx->coded_frame = avcodec_alloc_frame();
s->state = E_IF_init();
- s->allow_dtx = 0;
return 0;
}
@@ -103,9 +109,9 @@ static int amr_wb_encode_frame(AVCodecContext *avctx,
AMRWBContext *s = avctx->priv_data;
int size;
- if ((s->mode = getWBBitrateMode(avctx->bit_rate)) < 0) {
- av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported);
- return -1;
+ if (s->last_bitrate != avctx->bit_rate) {
+ s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx);
+ s->last_bitrate = avctx->bit_rate;
}
size = E_IF_encode(s->state, s->mode, data, frame, s->allow_dtx);
return size;
@@ -121,7 +127,8 @@ AVCodec ff_libvo_amrwbenc_encoder = {
amr_wb_encode_close,
NULL,
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("VisualOn libvo-amrwbenc Adaptive Multi-Rate "
+ .long_name = NULL_IF_CONFIG_SMALL("Android VisualOn Adaptive Multi-Rate "
"(AMR) Wide-Band"),
+ .priv_class = &class,
};
diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c
index 633b0657a1..7b179b6d5e 100644
--- a/libavcodec/msmpeg4.c
+++ b/libavcodec/msmpeg4.c
@@ -1279,7 +1279,8 @@ av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx)
int i;
MVTable *mv;
- ff_h263_decode_init(avctx);
+ if (ff_h263_decode_init(avctx) < 0)
+ return -1;
common_init(s);
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 78c0f7808d..bad6509a03 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -66,10 +66,10 @@
#define FF_API_INOFFICIAL (LIBAVCODEC_VERSION_MAJOR < 53)
#endif
#ifndef FF_API_OLD_SAMPLE_FMT
-#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 53)
+#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_OLD_AUDIOCONVERT
-#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 53)
+#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_HURRY_UP
#define FF_API_HURRY_UP (LIBAVCODEC_VERSION_MAJOR < 53)
@@ -84,7 +84,7 @@
#define FF_API_ANTIALIAS_ALGO (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_REQUEST_CHANNELS
-#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 53)
+#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#endif /* AVCODEC_VERSION_H */
diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c
index 7592dc3cc3..7e6d2d79e5 100644
--- a/libavformat/applehttp.c
+++ b/libavformat/applehttp.c
@@ -309,10 +309,13 @@ reload:
c->end_of_segment = 1;
c->cur_seq_no = v->cur_seq_no;
- v->needed = 0;
- for (i = v->stream_offset; i < v->stream_offset + v->ctx->nb_streams; i++) {
- if (v->parent->streams[i]->discard < AVDISCARD_ALL)
- v->needed = 1;
+ if (v->ctx) {
+ v->needed = 0;
+ for (i = v->stream_offset; i < v->stream_offset + v->ctx->nb_streams;
+ i++) {
+ if (v->parent->streams[i]->discard < AVDISCARD_ALL)
+ v->needed = 1;
+ }
}
if (!v->needed) {
av_log(v->parent, AV_LOG_INFO, "No longer receiving variant %d\n",
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 3eb4a1e3fb..423b135039 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -317,7 +317,7 @@ typedef struct AVOutputFormat {
enum CodecID subtitle_codec; /**< default subtitle codec */
-#if FF_API_OLD_METADATA
+#if FF_API_OLD_METADATA2
const AVMetadataConv *metadata_conv;
#endif
@@ -437,7 +437,7 @@ typedef struct AVInputFormat {
*/
int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
-#if FF_API_OLD_METADATA
+#if FF_API_OLD_METADATA2
const AVMetadataConv *metadata_conv;
#endif
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 934fa213e9..725a95f768 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -363,6 +363,7 @@ int ffurl_close(URLContext *h)
return ret;
}
+#if FF_API_OLD_AVIO
int url_exist(const char *filename)
{
URLContext *h;
@@ -371,6 +372,26 @@ int url_exist(const char *filename)
ffurl_close(h);
return 1;
}
+#endif
+
+int avio_check(const char *url, int flags)
+{
+ URLContext *h;
+ int ret = ffurl_alloc(&h, url, flags);
+ if (ret)
+ return ret;
+
+ if (h->prot->url_check) {
+ ret = h->prot->url_check(h, flags);
+ } else {
+ ret = ffurl_connect(h);
+ if (ret >= 0)
+ ret = flags;
+ }
+
+ ffurl_close(h);
+ return ret;
+}
int64_t ffurl_size(URLContext *h)
{
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 7deca337cf..9d805822d4 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -134,6 +134,7 @@ typedef struct URLProtocol {
int priv_data_size;
const AVClass *priv_data_class;
int flags;
+ int (*url_check)(URLContext *h, int mask);
} URLProtocol;
typedef struct URLPollEntry {
@@ -335,13 +336,31 @@ attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_siz
/** return the written or read size */
attribute_deprecated int url_close_buf(AVIOContext *s);
-#endif // FF_API_OLD_AVIO
/**
* Return a non-zero value if the resource indicated by url
* exists, 0 otherwise.
+ * @deprecated Use avio_check instead.
*/
-int url_exist(const char *url);
+attribute_deprecated int url_exist(const char *url);
+#endif // FF_API_OLD_AVIO
+
+/**
+ * Return AVIO_* access flags corresponding to the access permissions
+ * of the resource in url, or a negative value corresponding to an
+ * AVERROR code in case of failure. The returned access flags are
+ * masked by the value in flags.
+ *
+ * @note This function is intrinsically unsafe, in the sense that the
+ * checked resource may change its existence or permission status from
+ * one call to another. Thus you should not trust the returned value,
+ * unless you are sure that no other processes are accessing the
+ * checked resource.
+ *
+ * @note This function is slightly broken until next major bump
+ * because of AVIO_RDONLY == 0. Don't use it until then.
+ */
+int avio_check(const char *url, int flags);
/**
* The callback is called in blocking functions to test regulary if
@@ -537,9 +556,15 @@ int url_resetbuf(AVIOContext *s, int flags);
* constants, optionally ORed with other flags.
* @{
*/
+#if LIBAVFORMAT_VERSION_MAJOR < 53
#define AVIO_RDONLY 0 /**< read-only */
#define AVIO_WRONLY 1 /**< write-only */
#define AVIO_RDWR 2 /**< read-write */
+#else
+#define AVIO_RDONLY 1 /**< read-only */
+#define AVIO_WRONLY 2 /**< write-only */
+#define AVIO_RDWR 4 /**< read-write */
+#endif
/**
* @}
*/
@@ -556,7 +581,11 @@ int url_resetbuf(AVIOContext *s, int flags);
* Warning: non-blocking protocols is work-in-progress; this flag may be
* silently ignored.
*/
+#if LIBAVFORMAT_VERSION_MAJOR < 53
#define AVIO_FLAG_NONBLOCK 4
+#else
+#define AVIO_FLAG_NONBLOCK 8
+#endif
/**
* Create and initialize a AVIOContext for accessing the
diff --git a/libavformat/file.c b/libavformat/file.c
index 64f8782c97..9d28a89327 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -95,6 +95,20 @@ static int file_close(URLContext *h)
return close(fd);
}
+static int file_check(URLContext *h, int mask)
+{
+ struct stat st;
+ int ret = stat(h->filename, &st);
+ if (ret < 0)
+ return AVERROR(errno);
+
+ ret |= st.st_mode&S_IRUSR ? mask&AVIO_RDONLY : 0;
+ ret |= st.st_mode&S_IWUSR ? mask&AVIO_WRONLY : 0;
+ ret |= st.st_mode&S_IWUSR && st.st_mode&S_IRUSR ? mask&AVIO_RDWR : 0;
+
+ return ret;
+}
+
URLProtocol ff_file_protocol = {
.name = "file",
.url_open = file_open,
@@ -103,6 +117,7 @@ URLProtocol ff_file_protocol = {
.url_seek = file_seek,
.url_close = file_close,
.url_get_file_handle = file_get_handle,
+ .url_check = file_check,
};
#endif /* CONFIG_FILE_PROTOCOL */
@@ -137,6 +152,7 @@ URLProtocol ff_pipe_protocol = {
.url_read = file_read,
.url_write = file_write,
.url_get_file_handle = file_get_handle,
+ .url_check = file_check,
};
#endif /* CONFIG_PIPE_PROTOCOL */
diff --git a/libavformat/url.h b/libavformat/url.h
index 3f96f73763..56366644aa 100644
--- a/libavformat/url.h
+++ b/libavformat/url.h
@@ -59,6 +59,7 @@ typedef struct URLProtocol {
int priv_data_size;
const AVClass *priv_data_class;
int flags;
+ int (*url_check)(URLContext *h, int mask);
} URLProtocol;
#endif
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 0ea8ca94a9..1919f61d6a 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3086,7 +3086,10 @@ static int ff_interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacke
AVStream *st2= s->streams[ next->stream_index];
int64_t a= st2->time_base.num * (int64_t)st ->time_base.den;
int64_t b= st ->time_base.num * (int64_t)st2->time_base.den;
- return av_rescale_rnd(pkt->dts, b, a, AV_ROUND_DOWN) < next->dts;
+ int64_t dts1 = av_rescale_rnd(pkt->dts, b, a, AV_ROUND_DOWN);
+ if (dts1==next->dts && dts1==av_rescale_rnd(pkt->dts, b, a, AV_ROUND_UP))
+ return pkt->stream_index < next->stream_index;
+ return dts1 < next->dts;
}
int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush){
diff --git a/libavformat/version.h b/libavformat/version.h
index dad6161607..e795263a6d 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -24,7 +24,7 @@
#include "libavutil/avutil.h"
#define LIBAVFORMAT_VERSION_MAJOR 52
-#define LIBAVFORMAT_VERSION_MINOR 106
+#define LIBAVFORMAT_VERSION_MINOR 107
#define LIBAVFORMAT_VERSION_MICRO 0
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
index 7226853db4..a5cebcfb35 100644
--- a/libswscale/rgb2rgb.c
+++ b/libswscale/rgb2rgb.c
@@ -30,8 +30,6 @@
#include "swscale.h"
#include "swscale_internal.h"
-#define FAST_BGR2YV12 // use 7-bit instead of 15-bit coefficients
-
void (*rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long src_size);
void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size);
void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size);
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 7047bb80f4..c0e4db3b26 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -77,8 +77,6 @@ untested special converters
//#undef ARCH_X86
#define DITHER1XBPP
-#define FAST_BGR2YV12 // use 7 bit coefficients instead of 15 bit
-
#define isPacked(x) ( \
(x)==PIX_FMT_PAL8 \
|| (x)==PIX_FMT_YUYV422 \
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index 6604cae67d..9c2f822fff 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -31,6 +31,8 @@
#define STR(s) AV_TOSTRING(s) //AV_STRINGIFY is too long
+#define FAST_BGR2YV12 //use 7-bit instead of 15-bit coefficients
+
#define MAX_FILTER_SIZE 256
#if ARCH_X86
diff --git a/tests/ref/fate/8bps b/tests/ref/fate/8bps
index 6ee96177db..30ec8c5eba 100644
--- a/tests/ref/fate/8bps
+++ b/tests/ref/fate/8bps
@@ -1,5 +1,5 @@
-1, 0, 2048, 0x3d042426
0, 0, 259200, 0x7e91df07
+1, 0, 2048, 0x3d042426
1, 4180, 2048, 0x5bcae456
0, 7200, 259200, 0x7e91df07
1, 8359, 2048, 0xb6043655
diff --git a/tests/ref/fate/bethsoft-vid b/tests/ref/fate/bethsoft-vid
index 4c252bdf10..92c694b19e 100644
--- a/tests/ref/fate/bethsoft-vid
+++ b/tests/ref/fate/bethsoft-vid
@@ -1,5 +1,5 @@
-1, 0, 1480, 0x00000000
0, 0, 192000, 0x00000000
+1, 0, 1480, 0x00000000
0, 1500, 192000, 0x01a6cf45
0, 3000, 192000, 0xd07d57e9
0, 4500, 192000, 0x3cb1dff5
diff --git a/tests/ref/fate/bfi b/tests/ref/fate/bfi
index b0d853b98d..1471670ce3 100644
--- a/tests/ref/fate/bfi
+++ b/tests/ref/fate/bfi
@@ -1,5 +1,5 @@
-1, 0, 17768, 0x07df135c
0, 0, 134400, 0xc218b00c
+1, 0, 17768, 0x07df135c
0, 10000, 134400, 0x114daf7c
0, 20000, 134400, 0xe14db24c
0, 30000, 134400, 0x88c71df7
diff --git a/tests/ref/fate/corepng b/tests/ref/fate/corepng
index 7b01e7ab27..2b197d2709 100644
--- a/tests/ref/fate/corepng
+++ b/tests/ref/fate/corepng
@@ -1,5 +1,5 @@
-1, 0, 11026, 0x27ad637c
0, 0, 230400, 0x03e25ead
+1, 0, 11026, 0x27ad637c
0, 6000, 230400, 0x0a520ffd
0, 12000, 230400, 0x0b11a671
0, 18000, 230400, 0x7d3fce32
diff --git a/tests/ref/fate/creatureshock-avs b/tests/ref/fate/creatureshock-avs
index 54ed2f807f..bd6739f056 100644
--- a/tests/ref/fate/creatureshock-avs
+++ b/tests/ref/fate/creatureshock-avs
@@ -1,5 +1,5 @@
-1, 0, 16372, 0xfaaab59d
0, 0, 188892, 0xcb5be3dd
+1, 0, 16372, 0xfaaab59d
0, 6000, 188892, 0x0f313ebc
0, 12000, 188892, 0xc0da25cc
0, 18000, 188892, 0xad6e1d44
diff --git a/tests/ref/fate/feeble-dxa b/tests/ref/fate/feeble-dxa
index 309603233e..9013f99118 100644
--- a/tests/ref/fate/feeble-dxa
+++ b/tests/ref/fate/feeble-dxa
@@ -1,5 +1,5 @@
-1, 0, 1000, 0x64cd9403
0, 0, 921600, 0x0d03844f
+1, 0, 1000, 0x64cd9403
1, 4082, 1000, 0xa4ef8a9d
1, 8163, 1000, 0x75c19868
0, 9000, 921600, 0x0d03844f
diff --git a/tests/ref/fate/film-cvid-pcm-stereo-8bit b/tests/ref/fate/film-cvid-pcm-stereo-8bit
index ebe0fc45ca..3566b0f85a 100644
--- a/tests/ref/fate/film-cvid-pcm-stereo-8bit
+++ b/tests/ref/fate/film-cvid-pcm-stereo-8bit
@@ -1,5 +1,5 @@
-1, 0, 88192, 0x23bb50ae
0, 0, 107520, 0xa6c9fdd2
+1, 0, 88192, 0x23bb50ae
0, 3000, 107520, 0x61eb28c1
0, 6000, 107520, 0x45e20af7
0, 9000, 107520, 0x45e20af7
@@ -31,8 +31,8 @@
0, 81000, 107520, 0xee7324f0
0, 84000, 107520, 0xe15025b3
0, 87000, 107520, 0xe15025b3
-1, 90000, 44112, 0x18fed048
0, 90000, 107520, 0x8afa312e
+1, 90000, 44112, 0x18fed048
0, 93000, 107520, 0x8afa312e
0, 96000, 107520, 0x717a7d0f
0, 99000, 107520, 0x717a7d0f
@@ -65,8 +65,8 @@
0, 171000, 107520, 0x14147bd6
0, 174000, 107520, 0x07d54bec
0, 177000, 107520, 0x07d54bec
-1, 180000, 44112, 0xddc19d91
0, 180000, 107520, 0xe287a0a7
+1, 180000, 44112, 0xddc19d91
0, 183000, 107520, 0xe287a0a7
0, 186000, 107520, 0xc023a14d
0, 189000, 107520, 0xc023a14d
@@ -99,8 +99,8 @@
0, 261000, 107520, 0x3e0e4d8d
0, 264000, 107520, 0xd268865b
0, 267000, 107520, 0xd268865b
-1, 270000, 44112, 0x99c8c3d9
0, 270000, 107520, 0x89a4efeb
+1, 270000, 44112, 0x99c8c3d9
0, 273000, 107520, 0x89a4efeb
0, 276000, 107520, 0x70ca2478
0, 279000, 107520, 0x70ca2478
@@ -133,8 +133,8 @@
0, 351000, 107520, 0x3a1d7571
0, 354000, 107520, 0x3a1d7571
0, 357000, 107520, 0x3a1d7571
-1, 360000, 44112, 0x9e475274
0, 360000, 107520, 0xe974733e
+1, 360000, 44112, 0x9e475274
0, 363000, 107520, 0xe974733e
0, 366000, 107520, 0x999c6fbf
0, 369000, 107520, 0x999c6fbf
@@ -167,8 +167,8 @@
0, 441000, 107520, 0xfce5fd07
0, 444000, 107520, 0xd993f193
0, 447000, 107520, 0xd993f193
-1, 450000, 44112, 0xb8f86e48
0, 450000, 107520, 0x4d48e7b4
+1, 450000, 44112, 0xb8f86e48
0, 453000, 107520, 0x4d48e7b4
0, 456000, 107520, 0x61ccdf83
0, 459000, 107520, 0x61ccdf83
@@ -201,8 +201,8 @@
0, 531000, 107520, 0xf464c343
0, 534000, 107520, 0xf464c343
0, 537000, 107520, 0xf464c343
-1, 540000, 44112, 0xe0ac619f
0, 540000, 107520, 0xf464c343
+1, 540000, 44112, 0xe0ac619f
0, 543000, 107520, 0xf464c343
0, 546000, 107520, 0xf2b2c712
0, 549000, 107520, 0xf2b2c712
@@ -235,8 +235,8 @@
0, 621000, 107520, 0x5ecc379e
0, 624000, 107520, 0xea09432a
0, 627000, 107520, 0xea09432a
-1, 630000, 44112, 0x00000000
0, 630000, 107520, 0xe01e6b73
+1, 630000, 44112, 0x00000000
0, 633000, 107520, 0xe01e6b73
0, 636000, 107520, 0x1d13bba8
0, 639000, 107520, 0x1d13bba8
diff --git a/tests/ref/fate/idroq-video-dpcm b/tests/ref/fate/idroq-video-dpcm
index cad87fe324..7e0a10ee2e 100644
--- a/tests/ref/fate/idroq-video-dpcm
+++ b/tests/ref/fate/idroq-video-dpcm
@@ -1,5 +1,5 @@
-1, 0, 29824, 0x77e265b7
0, 0, 393216, 0x56995aac
+1, 0, 29824, 0x77e265b7
0, 3000, 393216, 0xf9ed5d6c
0, 6000, 393216, 0xd3285d75
0, 9000, 393216, 0x82d15d62
diff --git a/tests/ref/fate/interplay-mve-16bit b/tests/ref/fate/interplay-mve-16bit
index 2d22cca68c..74f0b350c6 100644
--- a/tests/ref/fate/interplay-mve-16bit
+++ b/tests/ref/fate/interplay-mve-16bit
@@ -1,5 +1,5 @@
-1, 0, 5788, 0x916d2db8
0, 0, 614400, 0x00000000
+1, 0, 5788, 0x916d2db8
1, 2953, 5888, 0xc65cb069
0, 3002, 614400, 0x00000000
1, 5957, 5888, 0xd8ec1acc
diff --git a/tests/ref/fate/interplay-mve-8bit b/tests/ref/fate/interplay-mve-8bit
index 0b41f352ea..13959c3cf2 100644
--- a/tests/ref/fate/interplay-mve-8bit
+++ b/tests/ref/fate/interplay-mve-8bit
@@ -1,5 +1,5 @@
-1, 0, 5848, 0xea04292b
0, 0, 414720, 0xa5cd50ca
+1, 0, 5848, 0xea04292b
1, 5967, 5888, 0x0e59e942
0, 6006, 414720, 0x3facd321
1, 11976, 5888, 0x56d480f6
diff --git a/tests/ref/fate/lmlm4-demux b/tests/ref/fate/lmlm4-demux
index 8ecf4b2db9..f322300eee 100644
--- a/tests/ref/fate/lmlm4-demux
+++ b/tests/ref/fate/lmlm4-demux
@@ -1,5 +1,5 @@
-1, 0, 768, 0xaebcbebb
0, 0, 5951, 0xe9118e0d
+1, 0, 768, 0xaebcbebb
1, 2160, 768, 0xaebcbebb
0, 3003, 1672, 0x4b80d4ca
1, 4320, 768, 0xaebcbebb
diff --git a/tests/ref/fate/mtv b/tests/ref/fate/mtv
index d7dfa94a4b..6699f62b58 100644
--- a/tests/ref/fate/mtv
+++ b/tests/ref/fate/mtv
@@ -1,5 +1,5 @@
-1, 0, 417, 0xae1cc66a
0, 0, 18432, 0xbd7e0ac8
+1, 0, 417, 0xae1cc66a
1, 2351, 418, 0xdc3ec850
1, 4702, 418, 0x4e8ed05f
0, 5625, 18432, 0xbd7e0ac8
diff --git a/tests/ref/fate/nuv b/tests/ref/fate/nuv
index 204a4112e7..b047378954 100644
--- a/tests/ref/fate/nuv
+++ b/tests/ref/fate/nuv
@@ -1,5 +1,5 @@
-1, 0, 4096, 0x00000000
0, 0, 460800, 0x54aedafe
+1, 0, 4096, 0x00000000
1, 2090, 4096, 0x4dfae7a6
0, 3003, 460800, 0x54aedafe
1, 4180, 4096, 0x3fd9f5c6
diff --git a/tests/ref/fate/psx-str b/tests/ref/fate/psx-str
index c0b990854f..3872e289e5 100644
--- a/tests/ref/fate/psx-str
+++ b/tests/ref/fate/psx-str
@@ -1,5 +1,5 @@
-1, 0, 8064, 0x02260037
0, 0, 115200, 0x6b106a56
+1, 0, 8064, 0x02260037
1, 4800, 8064, 0x4ee9f4e9
0, 6000, 115200, 0x53c16930
1, 9600, 8064, 0xf8fd82aa
@@ -7,8 +7,8 @@
1, 14400, 8064, 0xc100792b
0, 18000, 115200, 0xc3c18ba0
1, 19200, 8064, 0xf11a5316
-1, 24000, 8064, 0x6937f8c0
0, 24000, 115200, 0xe281b655
+1, 24000, 8064, 0x6937f8c0
1, 28800, 8064, 0xed194e42
0, 30000, 115200, 0x7b1e0536
1, 33600, 8064, 0x619ce54b
@@ -16,8 +16,8 @@
1, 38400, 8064, 0x544999ec
0, 42000, 115200, 0xfc67bf8e
1, 43200, 8064, 0x0ea877b4
-1, 48000, 8064, 0xb764d1c0
0, 48000, 115200, 0xb463151c
+1, 48000, 8064, 0xb764d1c0
1, 52800, 8064, 0x7a2fd211
0, 54000, 115200, 0x6e686846
1, 57600, 8064, 0xff69f6c5
@@ -25,8 +25,8 @@
1, 62400, 8064, 0x26c11ec7
0, 66000, 115200, 0x17b91efc
1, 67200, 8064, 0xfb4ecc0c
-1, 72000, 8064, 0x111d799b
0, 72000, 115200, 0xc051a49a
+1, 72000, 8064, 0x111d799b
1, 76800, 8064, 0xc704dc91
0, 78000, 115200, 0xc68c227b
1, 81600, 8064, 0xa9f372fb
@@ -34,8 +34,8 @@
1, 86400, 8064, 0xa3f0ad0f
0, 90000, 115200, 0x09d56ecc
1, 91200, 8064, 0x958719b9
-1, 96000, 8064, 0x9b011bf7
0, 96000, 115200, 0xc20e3485
+1, 96000, 8064, 0x9b011bf7
1, 100800, 8064, 0x466d96fb
0, 102000, 115200, 0xf07e2c48
1, 105600, 8064, 0x6ed4eb29
@@ -43,8 +43,8 @@
1, 110400, 8064, 0x066966db
0, 114000, 115200, 0xed65bacd
1, 115200, 8064, 0xf60fe0bc
-1, 120000, 8064, 0x2c845167
0, 120000, 115200, 0x51a23a3b
+1, 120000, 8064, 0x2c845167
1, 124800, 8064, 0x7d63894f
0, 126000, 115200, 0x559ddce1
1, 129600, 8064, 0x0682ee36
@@ -52,8 +52,8 @@
1, 134400, 8064, 0xcaeb7c70
0, 138000, 115200, 0x11b2dece
1, 139200, 8064, 0x93948697
-1, 144000, 8064, 0x5805f0d6
0, 144000, 115200, 0x851b877c
+1, 144000, 8064, 0x5805f0d6
1, 148800, 8064, 0xcfb641ff
0, 150000, 115200, 0x5f9a7c99
1, 153600, 8064, 0xe3499bb1
@@ -61,8 +61,8 @@
1, 158400, 8064, 0x689fe483
0, 162000, 115200, 0x950b0de8
1, 163200, 8064, 0x1b8f2f2d
-1, 168000, 8064, 0x23852e71
0, 168000, 115200, 0x6ec4c89a
+1, 168000, 8064, 0x23852e71
1, 172800, 8064, 0x15e7b298
0, 174000, 115200, 0xa9234812
1, 177600, 8064, 0x5345a9a3
@@ -70,8 +70,8 @@
1, 182400, 8064, 0x257b6ecf
0, 186000, 115200, 0x2cc1a2aa
1, 187200, 8064, 0xaf62836c
-1, 192000, 8064, 0xc3a401e3
0, 192000, 115200, 0x5df53b71
+1, 192000, 8064, 0xc3a401e3
1, 196800, 8064, 0x2b98fdf1
0, 198000, 115200, 0xe1d0cb31
1, 201600, 8064, 0x37168697
@@ -79,8 +79,8 @@
1, 206400, 8064, 0x2d876c89
0, 210000, 115200, 0x9342d739
1, 211200, 8064, 0xc40a6ada
-1, 216000, 8064, 0xcca6b829
0, 216000, 115200, 0x586bc658
+1, 216000, 8064, 0xcca6b829
1, 220800, 8064, 0x6667550a
0, 222000, 115200, 0x76902834
1, 225600, 8064, 0x99c1b5cb
@@ -88,8 +88,8 @@
1, 230400, 8064, 0xc05d3ed3
0, 234000, 115200, 0xce8c95fb
1, 235200, 8064, 0xdd641781
-1, 240000, 8064, 0xa65d49dc
0, 240000, 115200, 0xdf0d3de6
+1, 240000, 8064, 0xa65d49dc
1, 244800, 8064, 0x2a0d5df7
0, 246000, 115200, 0x120db7ae
1, 249600, 8064, 0xa6348438
@@ -97,8 +97,8 @@
1, 254400, 8064, 0xf2e1412d
0, 258000, 115200, 0x2498d3b6
1, 259200, 8064, 0xc41c6a7a
-1, 264000, 8064, 0x147edc3d
0, 264000, 115200, 0x99975ff8
+1, 264000, 8064, 0x147edc3d
1, 268800, 8064, 0x17e3cfe7
0, 270000, 115200, 0xbad65f9f
1, 273600, 8064, 0x01fe3969
@@ -106,8 +106,8 @@
1, 278400, 8064, 0xc437ac11
0, 282000, 115200, 0x6f8a61a0
1, 283200, 8064, 0xbbf747c1
-1, 288000, 8064, 0x2a4b88c0
0, 288000, 115200, 0x80c96143
+1, 288000, 8064, 0x2a4b88c0
1, 292800, 8064, 0xcd149c80
0, 294000, 115200, 0x663c6198
1, 297600, 8064, 0xcf339dfc
@@ -115,8 +115,8 @@
1, 302400, 8064, 0xc81ff84b
0, 306000, 115200, 0xfe186346
1, 307200, 8064, 0x4d978100
-1, 312000, 8064, 0x6da6665b
0, 312000, 115200, 0x844962f8
+1, 312000, 8064, 0x6da6665b
1, 316800, 8064, 0x12fa354f
0, 318000, 115200, 0x917c672f
1, 321600, 8064, 0x6baedae6
@@ -124,8 +124,8 @@
1, 326400, 8064, 0xddd77327
0, 330000, 115200, 0xace06816
1, 331200, 8064, 0x0a31c118
-1, 336000, 8064, 0x7652ee6e
0, 336000, 115200, 0x4ef26aa2
+1, 336000, 8064, 0x7652ee6e
1, 340800, 8064, 0x486a24cc
0, 342000, 115200, 0xf2046bb3
1, 345600, 8064, 0xf6cf01ee
@@ -133,8 +133,8 @@
1, 350400, 8064, 0x2a19e830
0, 354000, 115200, 0x8a17716d
1, 355200, 8064, 0xde675a31
-1, 360000, 8064, 0xeefcc9af
0, 360000, 115200, 0x36127568
+1, 360000, 8064, 0xeefcc9af
1, 364800, 8064, 0xaec4c989
0, 366000, 115200, 0x3e877b5c
1, 369600, 8064, 0x16b73de9
@@ -142,8 +142,8 @@
1, 374400, 8064, 0x188a582a
0, 378000, 115200, 0x41bc8a39
1, 379200, 8064, 0xc092e73d
-1, 384000, 8064, 0xf7ebca97
0, 384000, 115200, 0x6f839446
+1, 384000, 8064, 0xf7ebca97
1, 388800, 8064, 0x170ce07a
0, 390000, 115200, 0xef74a005
1, 393600, 8064, 0xa0705384
@@ -151,8 +151,8 @@
1, 398400, 8064, 0xd0154a3c
0, 402000, 115200, 0x4607cf99
1, 403200, 8064, 0x57c73c6c
-1, 408000, 8064, 0x590c9ddb
0, 408000, 115200, 0x4c18e8db
+1, 408000, 8064, 0x590c9ddb
1, 412800, 8064, 0x2cbe552f
0, 414000, 115200, 0x04d71efb
1, 417600, 8064, 0x0d286932
@@ -160,8 +160,8 @@
1, 422400, 8064, 0x5931cea3
0, 426000, 115200, 0x4dd48d01
1, 427200, 8064, 0xaf0fb80d
-1, 432000, 8064, 0x7fb61e9b
0, 432000, 115200, 0x5fa9627f
+1, 432000, 8064, 0x7fb61e9b
1, 436800, 8064, 0xf17134bb
0, 438000, 115200, 0x7a413f88
1, 441600, 8064, 0xd647859a
@@ -169,8 +169,8 @@
1, 446400, 8064, 0x55a60921
0, 450000, 115200, 0x3d720e05
1, 451200, 8064, 0x3811fa58
-1, 456000, 8064, 0xaceeccea
0, 456000, 115200, 0x49243fd8
+1, 456000, 8064, 0xaceeccea
1, 460800, 8064, 0x5fcedf14
0, 462000, 115200, 0x9834b697
1, 465600, 8064, 0xd8c64abf
@@ -178,8 +178,8 @@
1, 470400, 8064, 0x79495e8d
0, 474000, 115200, 0x3eaf5504
1, 475200, 8064, 0x4b7db039
-1, 480000, 8064, 0x7152f86d
0, 480000, 115200, 0x057a3701
+1, 480000, 8064, 0x7152f86d
1, 484800, 8064, 0xd92cfc1a
0, 486000, 115200, 0x6e88f21a
1, 489600, 8064, 0x75c540ef
@@ -187,8 +187,8 @@
1, 494400, 8064, 0x9c03ef5e
0, 498000, 115200, 0x92212d84
1, 499200, 8064, 0x7b2911c8
-1, 504000, 8064, 0x69d9d553
0, 504000, 115200, 0xf6b0a4ff
+1, 504000, 8064, 0x69d9d553
1, 508800, 8064, 0xcb45d7c5
0, 510000, 115200, 0xb49e9b4e
1, 513600, 8064, 0x37ec8b0a
@@ -196,5 +196,5 @@
1, 518400, 8064, 0xe4354221
0, 522000, 115200, 0x65f3339a
1, 523200, 8064, 0xc0d91cdb
-1, 528000, 8064, 0xea0be175
0, 528000, 115200, 0x38e40a20
+1, 528000, 8064, 0xea0be175
diff --git a/tests/ref/fate/sierra-vmd b/tests/ref/fate/sierra-vmd
index 91a8e46548..8ea1570472 100644
--- a/tests/ref/fate/sierra-vmd
+++ b/tests/ref/fate/sierra-vmd
@@ -27,184 +27,184 @@
0, 225000, 230400, 0x76aebdae
0, 234000, 230400, 0x81357545
0, 243000, 230400, 0x38baeebd
-1, 252000, 4410, 0x109d04e0
0, 252000, 230400, 0x1c5c44d4
-1, 261000, 4410, 0x224d244f
+1, 252000, 4410, 0x109d04e0
0, 261000, 230400, 0x60e189cc
-1, 270000, 4410, 0xbb72413d
+1, 261000, 4410, 0x224d244f
0, 270000, 230400, 0xb1f4381c
-1, 279000, 4410, 0xaa5f5b86
+1, 270000, 4410, 0xbb72413d
0, 279000, 230400, 0xb5048fed
-1, 288000, 4410, 0x94e7aea7
+1, 279000, 4410, 0xaa5f5b86
0, 288000, 230400, 0xc947c30e
-1, 297000, 4410, 0xad497ca0
+1, 288000, 4410, 0x94e7aea7
0, 297000, 230400, 0xe8e31c07
-1, 306000, 4410, 0x1de10c9e
+1, 297000, 4410, 0xad497ca0
0, 306000, 230400, 0x6d49dd02
-1, 315000, 4410, 0x9f55efa8
+1, 306000, 4410, 0x1de10c9e
0, 315000, 230400, 0x293e15d3
-1, 324000, 4410, 0x220a072a
+1, 315000, 4410, 0x9f55efa8
0, 324000, 230400, 0x354d792e
-1, 333000, 4410, 0xa7dafb29
+1, 324000, 4410, 0x220a072a
0, 333000, 230400, 0x35468780
-1, 342000, 4410, 0xd5e29c7a
+1, 333000, 4410, 0xa7dafb29
0, 342000, 230400, 0x365d3991
-1, 351000, 4410, 0xb8465006
+1, 342000, 4410, 0xd5e29c7a
0, 351000, 230400, 0xc9debef2
-1, 360000, 4410, 0x518669c7
+1, 351000, 4410, 0xb8465006
0, 360000, 230400, 0x4c4634c2
-1, 369000, 4410, 0xb5b5efca
+1, 360000, 4410, 0x518669c7
0, 369000, 230400, 0x347c2dca
-1, 378000, 4410, 0x8600015d
+1, 369000, 4410, 0xb5b5efca
0, 378000, 230400, 0x1efa0aaa
-1, 387000, 4410, 0xe2f68fe9
+1, 378000, 4410, 0x8600015d
0, 387000, 230400, 0xa79a0b5a
-1, 396000, 4410, 0x8d3458d9
+1, 387000, 4410, 0xe2f68fe9
0, 396000, 230400, 0xfdb2dcdb
-1, 405000, 4410, 0xf1ff4775
+1, 396000, 4410, 0x8d3458d9
0, 405000, 230400, 0x42dbea33
-1, 414000, 4410, 0x830f67c9
+1, 405000, 4410, 0xf1ff4775
0, 414000, 230400, 0x2a207e43
-1, 423000, 4410, 0x110e0bc1
+1, 414000, 4410, 0x830f67c9
0, 423000, 230400, 0x86573783
-1, 432000, 4410, 0x71682f47
+1, 423000, 4410, 0x110e0bc1
0, 432000, 230400, 0xc3968473
-1, 441000, 4410, 0x38119095
+1, 432000, 4410, 0x71682f47
0, 441000, 230400, 0x8f62a7b4
-1, 450000, 4410, 0xd2494db6
+1, 441000, 4410, 0x38119095
0, 450000, 230400, 0x5a2e3073
-1, 459000, 4410, 0x8b552509
+1, 450000, 4410, 0xd2494db6
0, 459000, 230400, 0xd24f5e2c
-1, 468000, 4410, 0x71e52909
+1, 459000, 4410, 0x8b552509
0, 468000, 230400, 0x1df3c67d
-1, 477000, 4410, 0x9f0a6f4d
+1, 468000, 4410, 0x71e52909
0, 477000, 230400, 0xe4fd884d
-1, 486000, 4410, 0x901302f2
+1, 477000, 4410, 0x9f0a6f4d
0, 486000, 230400, 0x9a228555
-1, 495000, 4410, 0x855d5222
+1, 486000, 4410, 0x901302f2
0, 495000, 230400, 0x9eba8ed5
-1, 504000, 4410, 0x324bb2fe
+1, 495000, 4410, 0x855d5222
0, 504000, 230400, 0x3d808a3d
-1, 513000, 4410, 0xe85f583f
+1, 504000, 4410, 0x324bb2fe
0, 513000, 230400, 0xf57e866d
-1, 522000, 4410, 0x2cbc67c4
+1, 513000, 4410, 0xe85f583f
0, 522000, 230400, 0x85f594f5
-1, 531000, 4410, 0xc82e6aa1
+1, 522000, 4410, 0x2cbc67c4
0, 531000, 230400, 0xb09f99dd
-1, 540000, 4410, 0xb9fc423c
+1, 531000, 4410, 0xc82e6aa1
0, 540000, 230400, 0x2b368475
-1, 549000, 4410, 0x6b9b4ef9
+1, 540000, 4410, 0xb9fc423c
0, 549000, 230400, 0xa2417afd
-1, 558000, 4410, 0x39290f10
+1, 549000, 4410, 0x6b9b4ef9
0, 558000, 230400, 0x590b709d
-1, 567000, 4410, 0xad718eb4
+1, 558000, 4410, 0x39290f10
0, 567000, 230400, 0x5d617705
-1, 576000, 4410, 0x82f463ac
+1, 567000, 4410, 0xad718eb4
0, 576000, 230400, 0xabf981ad
-1, 585000, 4410, 0xfac87cac
+1, 576000, 4410, 0x82f463ac
0, 585000, 230400, 0x5a8590cd
-1, 594000, 4410, 0x9e8bcca7
+1, 585000, 4410, 0xfac87cac
0, 594000, 230400, 0x1bff853d
-1, 603000, 4410, 0x52f79c99
+1, 594000, 4410, 0x9e8bcca7
0, 603000, 230400, 0x71d08055
-1, 612000, 4410, 0xf2d14de2
+1, 603000, 4410, 0x52f79c99
0, 612000, 230400, 0x2ebd817d
-1, 621000, 4410, 0x367f95e1
+1, 612000, 4410, 0xf2d14de2
0, 621000, 230400, 0x6e838255
-1, 630000, 4410, 0x8bfac293
+1, 621000, 4410, 0x367f95e1
0, 630000, 230400, 0x043984cd
-1, 639000, 4410, 0x01ea5040
+1, 630000, 4410, 0x8bfac293
0, 639000, 230400, 0x7ff18495
-1, 648000, 4410, 0x8ff5e212
+1, 639000, 4410, 0x01ea5040
0, 648000, 230400, 0xa43b8385
-1, 657000, 4410, 0x93f32824
+1, 648000, 4410, 0x8ff5e212
0, 657000, 230400, 0x72b5825d
-1, 666000, 4410, 0x998f90dc
+1, 657000, 4410, 0x93f32824
0, 666000, 230400, 0x3a178085
-1, 675000, 4410, 0x65231170
+1, 666000, 4410, 0x998f90dc
0, 675000, 230400, 0x67748245
-1, 684000, 4410, 0xc79039a1
+1, 675000, 4410, 0x65231170
0, 684000, 230400, 0xeddf81d5
-1, 693000, 4410, 0x0b0e58bd
+1, 684000, 4410, 0xc79039a1
0, 693000, 230400, 0x8b088665
-1, 702000, 4410, 0xc24ab4fa
+1, 693000, 4410, 0x0b0e58bd
0, 702000, 230400, 0x6c408e15
-1, 711000, 4410, 0xd3796a8e
+1, 702000, 4410, 0xc24ab4fa
0, 711000, 230400, 0x81f196dd
-1, 720000, 4410, 0xa37f8295
+1, 711000, 4410, 0xd3796a8e
0, 720000, 230400, 0xab9f953d
-1, 729000, 4410, 0xb760fed7
+1, 720000, 4410, 0xa37f8295
0, 729000, 230400, 0xa5f69795
-1, 738000, 4410, 0x05495a34
+1, 729000, 4410, 0xb760fed7
0, 738000, 230400, 0xa772950d
-1, 747000, 4410, 0x6f203437
+1, 738000, 4410, 0x05495a34
0, 747000, 230400, 0x6a5596d5
-1, 756000, 4410, 0x71299402
+1, 747000, 4410, 0x6f203437
0, 756000, 230400, 0x1355958d
-1, 765000, 4410, 0x72e7b346
+1, 756000, 4410, 0x71299402
0, 765000, 230400, 0x4134981d
-1, 774000, 4410, 0x879b0dae
+1, 765000, 4410, 0x72e7b346
0, 774000, 230400, 0x8b929515
-1, 783000, 4410, 0x041aa1bd
+1, 774000, 4410, 0x879b0dae
0, 783000, 230400, 0x482f95c5
-1, 792000, 4410, 0x18a962e6
+1, 783000, 4410, 0x041aa1bd
0, 792000, 230400, 0x7a9795d5
-1, 801000, 4410, 0x21d20539
+1, 792000, 4410, 0x18a962e6
0, 801000, 230400, 0x21c29abd
-1, 810000, 4410, 0x8f449267
+1, 801000, 4410, 0x21d20539
0, 810000, 230400, 0x9ae6a475
-1, 819000, 4410, 0xecdc01d6
+1, 810000, 4410, 0x8f449267
0, 819000, 230400, 0x3734aee5
-1, 828000, 4410, 0x458abd5a
+1, 819000, 4410, 0xecdc01d6
0, 828000, 230400, 0xa0a1b365
-1, 837000, 4410, 0xa070ea63
+1, 828000, 4410, 0x458abd5a
0, 837000, 230400, 0x2dcab1c5
-1, 846000, 4410, 0xc25b26ce
+1, 837000, 4410, 0xa070ea63
0, 846000, 230400, 0x9c8b6c44
-1, 855000, 4410, 0x4d9237ca
+1, 846000, 4410, 0xc25b26ce
0, 855000, 230400, 0x5da75feb
-1, 864000, 4410, 0x748e1801
+1, 855000, 4410, 0x4d9237ca
0, 864000, 230400, 0x4d02f8e3
-1, 873000, 4410, 0xc96b69e6
+1, 864000, 4410, 0x748e1801
0, 873000, 230400, 0x66824f3a
-1, 882000, 4410, 0x6663186c
+1, 873000, 4410, 0xc96b69e6
0, 882000, 230400, 0x0c9257e2
-1, 891000, 4410, 0x7f6d3081
+1, 882000, 4410, 0x6663186c
0, 891000, 230400, 0xb2927092
-1, 900000, 4410, 0x1a0343b5
+1, 891000, 4410, 0x7f6d3081
0, 900000, 230400, 0xb5dc6e9a
-1, 909000, 4410, 0xc48e338c
+1, 900000, 4410, 0x1a0343b5
0, 909000, 230400, 0x6e567bc6
-1, 918000, 4410, 0x26fc03c8
+1, 909000, 4410, 0xc48e338c
0, 918000, 230400, 0xbf9e0f7a
-1, 927000, 4410, 0x69be7e2d
+1, 918000, 4410, 0x26fc03c8
0, 927000, 230400, 0xb16f684a
-1, 936000, 4410, 0x69a74da1
+1, 927000, 4410, 0x69be7e2d
0, 936000, 230400, 0xf9e55e81
-1, 945000, 4410, 0x85bd2ab3
+1, 936000, 4410, 0x69a74da1
0, 945000, 230400, 0xd8d0bcba
-1, 954000, 4410, 0xeff05426
+1, 945000, 4410, 0x85bd2ab3
0, 954000, 230400, 0x44720ac0
-1, 963000, 4410, 0x292829e0
+1, 954000, 4410, 0xeff05426
0, 963000, 230400, 0x7d4c2058
-1, 972000, 4410, 0x8f741798
+1, 963000, 4410, 0x292829e0
0, 972000, 230400, 0xb0973eb9
-1, 981000, 4410, 0x6b9337e9
+1, 972000, 4410, 0x8f741798
0, 981000, 230400, 0x405a13ce
-1, 990000, 4410, 0xe4e1703f
+1, 981000, 4410, 0x6b9337e9
0, 990000, 230400, 0x6422f00a
-1, 999000, 4410, 0x043d6c35
+1, 990000, 4410, 0xe4e1703f
0, 999000, 230400, 0x924b6c1e
-1, 1008000, 4410, 0x3a8988e7
+1, 999000, 4410, 0x043d6c35
0, 1008000, 230400, 0xcf7809c0
-1, 1017000, 4410, 0x1fa7d2a9
+1, 1008000, 4410, 0x3a8988e7
0, 1017000, 230400, 0x883a3863
-1, 1026000, 4410, 0xe28799e3
+1, 1017000, 4410, 0x1fa7d2a9
0, 1026000, 230400, 0x6adc9e03
-1, 1035000, 4410, 0xc2df4470
+1, 1026000, 4410, 0xe28799e3
0, 1035000, 230400, 0x4f5ab7a8
-1, 1044000, 4410, 0x694d0cf5
+1, 1035000, 4410, 0xc2df4470
0, 1044000, 230400, 0xdc0aab94
+1, 1044000, 4410, 0x694d0cf5
1, 1053000, 4410, 0x5aac2dcf
1, 1062000, 4410, 0x259fa2db
1, 1071000, 4410, 0xd16d6803
diff --git a/tests/ref/fate/siff b/tests/ref/fate/siff
index 2f67254b5d..05c12c2088 100644
--- a/tests/ref/fate/siff
+++ b/tests/ref/fate/siff
@@ -1,5 +1,5 @@
-1, 0, 44100, 0xd0a49e09
0, 0, 230400, 0x3bd1d731
+1, 0, 44100, 0xd0a49e09
0, 7500, 230400, 0x9d0774c3
0, 15000, 230400, 0xa0faafe2
0, 22500, 230400, 0x38325309
@@ -11,8 +11,8 @@
0, 67500, 230400, 0x07178dd9
0, 75000, 230400, 0xf52b8db4
0, 82500, 230400, 0x2b70c1dc
-1, 90000, 44100, 0xf151af4d
0, 90000, 230400, 0x8157a6e9
+1, 90000, 44100, 0xf151af4d
0, 97500, 230400, 0xd4a3c357
0, 105000, 230400, 0x703861bb
0, 112500, 230400, 0xa13cf75e
@@ -24,8 +24,8 @@
0, 157500, 230400, 0x22050962
0, 165000, 230400, 0x0f5c8a0d
0, 172500, 230400, 0x3475df44
-1, 180000, 44100, 0xecd3cd08
0, 180000, 230400, 0x65354e06
+1, 180000, 44100, 0xecd3cd08
0, 187500, 230400, 0xb9a01978
0, 195000, 230400, 0x15207ee1
0, 202500, 230400, 0x3b214f0b
diff --git a/tests/ref/fate/tiertex-seq b/tests/ref/fate/tiertex-seq
index e4ebf5a207..6aa7fc7b9f 100644
--- a/tests/ref/fate/tiertex-seq
+++ b/tests/ref/fate/tiertex-seq
@@ -1,147 +1,147 @@
-1, 0, 1764, 0x00000000
0, 0, 98304, 0x2e5db4a4
-1, 3600, 1764, 0x80a253d9
+1, 0, 1764, 0x00000000
0, 3600, 98304, 0xb20c19d0
-1, 7200, 1764, 0x95a16721
+1, 3600, 1764, 0x80a253d9
0, 7200, 98304, 0xb20c19d0
-1, 10800, 1764, 0x0f0d4cb6
+1, 7200, 1764, 0x95a16721
0, 10800, 98304, 0xb20c19d0
-1, 14400, 1764, 0x75026779
+1, 10800, 1764, 0x0f0d4cb6
0, 14400, 98304, 0x6b8538c0
-1, 18000, 1764, 0xb4356e37
+1, 14400, 1764, 0x75026779
0, 18000, 98304, 0x6b8538c0
-1, 21600, 1764, 0xfafa64cb
+1, 18000, 1764, 0xb4356e37
0, 21600, 98304, 0x6b8538c0
-1, 25200, 1764, 0xe8fd7970
+1, 21600, 1764, 0xfafa64cb
0, 25200, 98304, 0x172207e3
-1, 28800, 1764, 0x666879b7
+1, 25200, 1764, 0xe8fd7970
0, 28800, 98304, 0x172207e3
-1, 32400, 1764, 0xf2cd7770
+1, 28800, 1764, 0x666879b7
0, 32400, 98304, 0x172207e3
-1, 36000, 1764, 0x54317a1c
+1, 32400, 1764, 0xf2cd7770
0, 36000, 98304, 0x172207e3
-1, 39600, 1764, 0x9c396930
+1, 36000, 1764, 0x54317a1c
0, 39600, 98304, 0x63fb7dc1
-1, 43200, 1764, 0x87115ec4
+1, 39600, 1764, 0x9c396930
0, 43200, 98304, 0x63fb7dc1
-1, 46800, 1764, 0x0c9b69b6
+1, 43200, 1764, 0x87115ec4
0, 46800, 98304, 0x63fb7dc1
-1, 50400, 1764, 0x8c3a758a
+1, 46800, 1764, 0x0c9b69b6
0, 50400, 98304, 0x37cf1601
-1, 54000, 1764, 0x605d776a
+1, 50400, 1764, 0x8c3a758a
0, 54000, 98304, 0x37cf1601
-1, 57600, 1764, 0x0556852d
+1, 54000, 1764, 0x605d776a
0, 57600, 98304, 0x37cf1601
-1, 61200, 1764, 0x7d4363f8
+1, 57600, 1764, 0x0556852d
0, 61200, 98304, 0x37cf1601
-1, 64800, 1764, 0xc5cd75d0
+1, 61200, 1764, 0x7d4363f8
0, 64800, 98304, 0x82941990
-1, 68400, 1764, 0x3ff3646d
+1, 64800, 1764, 0xc5cd75d0
0, 68400, 98304, 0x82941990
-1, 72000, 1764, 0x10136d25
+1, 68400, 1764, 0x3ff3646d
0, 72000, 98304, 0x82941990
-1, 75600, 1764, 0xeb1a6cd0
+1, 72000, 1764, 0x10136d25
0, 75600, 98304, 0x82941990
-1, 79200, 1764, 0xef937ed1
+1, 75600, 1764, 0xeb1a6cd0
0, 79200, 98304, 0xe0a5309e
-1, 82800, 1764, 0x2d2b6f79
+1, 79200, 1764, 0xef937ed1
0, 82800, 98304, 0xe0a5309e
-1, 86400, 1764, 0x6f457231
+1, 82800, 1764, 0x2d2b6f79
0, 86400, 98304, 0xe0a5309e
-1, 90000, 1764, 0x56267c9d
+1, 86400, 1764, 0x6f457231
0, 90000, 98304, 0x164cb67d
-1, 93600, 1764, 0xd49e79c8
+1, 90000, 1764, 0x56267c9d
0, 93600, 98304, 0x164cb67d
-1, 97200, 1764, 0xc726703d
+1, 93600, 1764, 0xd49e79c8
0, 97200, 98304, 0x164cb67d
-1, 100800, 1764, 0x2abf8074
+1, 97200, 1764, 0xc726703d
0, 100800, 98304, 0x164cb67d
-1, 104400, 1764, 0xb50c556d
+1, 100800, 1764, 0x2abf8074
0, 104400, 98304, 0xed2189f8
-1, 108000, 1764, 0xc1f2523c
+1, 104400, 1764, 0xb50c556d
0, 108000, 98304, 0xed2189f8
-1, 111600, 1764, 0x850a6f93
+1, 108000, 1764, 0xc1f2523c
0, 111600, 98304, 0xed2189f8
-1, 115200, 1764, 0x8da76c31
+1, 111600, 1764, 0x850a6f93
0, 115200, 98304, 0x7215e529
-1, 118800, 1764, 0xfcccdf13
+1, 115200, 1764, 0x8da76c31
0, 118800, 98304, 0x7215e529
-1, 122400, 1764, 0x00000000
+1, 118800, 1764, 0xfcccdf13
0, 122400, 98304, 0x7215e529
-1, 126000, 1764, 0x00000000
+1, 122400, 1764, 0x00000000
0, 126000, 98304, 0x7215e529
-1, 129600, 1764, 0x00000000
+1, 126000, 1764, 0x00000000
0, 129600, 98304, 0x170c783b
-1, 133200, 1764, 0x00000000
+1, 129600, 1764, 0x00000000
0, 133200, 98304, 0x170c783b
-1, 136800, 1764, 0x00000000
+1, 133200, 1764, 0x00000000
0, 136800, 98304, 0x170c783b
-1, 140400, 1764, 0x00000000
+1, 136800, 1764, 0x00000000
0, 140400, 98304, 0xf6bd74c7
-1, 144000, 1764, 0x00000000
+1, 140400, 1764, 0x00000000
0, 144000, 98304, 0xf6bd74c7
-1, 147600, 1764, 0x00000000
+1, 144000, 1764, 0x00000000
0, 147600, 98304, 0xf6bd74c7
-1, 151200, 1764, 0x00000000
+1, 147600, 1764, 0x00000000
0, 151200, 98304, 0xf6bd74c7
-1, 154800, 1764, 0x00000000
+1, 151200, 1764, 0x00000000
0, 154800, 98304, 0x1efd38c4
-1, 158400, 1764, 0x00000000
+1, 154800, 1764, 0x00000000
0, 158400, 98304, 0x1efd38c4
-1, 162000, 1764, 0x00000000
+1, 158400, 1764, 0x00000000
0, 162000, 98304, 0x1efd38c4
-1, 165600, 1764, 0x00000000
+1, 162000, 1764, 0x00000000
0, 165600, 98304, 0x1efd38c4
-1, 169200, 1764, 0x00000000
+1, 165600, 1764, 0x00000000
0, 169200, 98304, 0x29c26bba
-1, 172800, 1764, 0x00000000
+1, 169200, 1764, 0x00000000
0, 172800, 98304, 0x29c26bba
-1, 176400, 1764, 0x00000000
+1, 172800, 1764, 0x00000000
0, 176400, 98304, 0x29c26bba
-1, 180000, 1764, 0x00000000
+1, 176400, 1764, 0x00000000
0, 180000, 98304, 0x880a6313
-1, 183600, 1764, 0x00000000
+1, 180000, 1764, 0x00000000
0, 183600, 98304, 0x880a6313
-1, 187200, 1764, 0x00000000
+1, 183600, 1764, 0x00000000
0, 187200, 98304, 0x880a6313
-1, 190800, 1764, 0x00000000
+1, 187200, 1764, 0x00000000
0, 190800, 98304, 0x880a6313
-1, 194400, 1764, 0x00000000
+1, 190800, 1764, 0x00000000
0, 194400, 98304, 0x73f5bb00
-1, 198000, 1764, 0x00000000
+1, 194400, 1764, 0x00000000
0, 198000, 98304, 0x73f5bb00
-1, 201600, 1764, 0x00000000
+1, 198000, 1764, 0x00000000
0, 201600, 98304, 0x73f5bb00
-1, 205200, 1764, 0x00000000
+1, 201600, 1764, 0x00000000
0, 205200, 98304, 0xc85b19ec
-1, 208800, 1764, 0x00000000
+1, 205200, 1764, 0x00000000
0, 208800, 98304, 0xc85b19ec
-1, 212400, 1764, 0x00000000
+1, 208800, 1764, 0x00000000
0, 212400, 98304, 0xc85b19ec
-1, 216000, 1764, 0x00000000
+1, 212400, 1764, 0x00000000
0, 216000, 98304, 0xc85b19ec
-1, 219600, 1764, 0x00000000
+1, 216000, 1764, 0x00000000
0, 219600, 98304, 0x00000000
-1, 223200, 1764, 0x00000000
+1, 219600, 1764, 0x00000000
0, 223200, 98304, 0x00000000
-1, 226800, 1764, 0x00000000
+1, 223200, 1764, 0x00000000
0, 226800, 98304, 0x00000000
-1, 230400, 1764, 0x00000000
+1, 226800, 1764, 0x00000000
0, 230400, 98304, 0x00000000
-1, 234000, 1764, 0x00000000
+1, 230400, 1764, 0x00000000
0, 234000, 98304, 0x00000000
-1, 237600, 1764, 0x00000000
+1, 234000, 1764, 0x00000000
0, 237600, 98304, 0x00000000
-1, 241200, 1764, 0x00000000
+1, 237600, 1764, 0x00000000
0, 241200, 98304, 0x00000000
-1, 244800, 1764, 0x00000000
+1, 241200, 1764, 0x00000000
0, 244800, 98304, 0x00000000
-1, 248400, 1764, 0x00000000
+1, 244800, 1764, 0x00000000
0, 248400, 98304, 0x00000000
-1, 252000, 1764, 0x00000000
+1, 248400, 1764, 0x00000000
0, 252000, 98304, 0x00000000
-1, 255600, 1764, 0x00000000
+1, 252000, 1764, 0x00000000
0, 255600, 98304, 0x00000000
+1, 255600, 1764, 0x00000000
1, 259200, 1764, 0x00000000
1, 262800, 1764, 0x00000000
1, 266400, 1764, 0x00000000
diff --git a/tests/ref/fate/truemotion1-15 b/tests/ref/fate/truemotion1-15
index 747fcb1551..d103f01970 100644
--- a/tests/ref/fate/truemotion1-15
+++ b/tests/ref/fate/truemotion1-15
@@ -1,5 +1,5 @@
-1, 0, 10832, 0xe1a811fa
0, 0, 161280, 0x7041748d
+1, 0, 10832, 0xe1a811fa
1, 5527, 10832, 0xb47841f9
0, 6000, 161280, 0x3cc4dfb5
1, 11053, 10832, 0x839eedf1
diff --git a/tests/ref/fate/truemotion1-24 b/tests/ref/fate/truemotion1-24
index a4e1203094..b0b1c4e44e 100644
--- a/tests/ref/fate/truemotion1-24
+++ b/tests/ref/fate/truemotion1-24
@@ -1,5 +1,5 @@
-1, 0, 10832, 0x1597b4c8
0, 0, 69120, 0x68beb30f
+1, 0, 10832, 0x1597b4c8
1, 5527, 10832, 0xf9479f8b
0, 6000, 69120, 0x3976f5cf
1, 11053, 10832, 0x8db50e74
diff --git a/tests/ref/fate/tscc-15bit b/tests/ref/fate/tscc-15bit
index fb4d558e0c..bc55f0fc50 100644
--- a/tests/ref/fate/tscc-15bit
+++ b/tests/ref/fate/tscc-15bit
@@ -1,5 +1,5 @@
-1, 0, 22050, 0x1740aaec
0, 0, 657600, 0xaf456809
+1, 0, 22050, 0x1740aaec
0, 6000, 657600, 0xaf456809
0, 12000, 657600, 0xaf456809
0, 18000, 657600, 0x2dbe6889
@@ -14,8 +14,8 @@
0, 72000, 657600, 0x2dbe6889
0, 78000, 657600, 0x2dbe6889
0, 84000, 657600, 0x2dbe6889
-1, 90000, 22050, 0x75ed6086
0, 90000, 657600, 0x2dbe6889
+1, 90000, 22050, 0x75ed6086
0, 96000, 657600, 0x2dbe6889
0, 102000, 657600, 0x2dbe6889
0, 108000, 657600, 0x2dbe6889
@@ -30,8 +30,8 @@
0, 162000, 657600, 0x64cb6889
0, 168000, 657600, 0x64cb6889
0, 174000, 657600, 0x64cb6889
-1, 180000, 22050, 0xca52a4e9
0, 180000, 657600, 0x42036b71
+1, 180000, 22050, 0xca52a4e9
0, 186000, 657600, 0x42036b71
0, 192000, 657600, 0x42036b71
0, 198000, 657600, 0xc40a6889
@@ -46,8 +46,8 @@
0, 252000, 657600, 0x22d10de0
0, 258000, 657600, 0xa75f0d60
0, 264000, 657600, 0x7a440be0
-1, 270000, 22050, 0xb306d419
0, 270000, 657600, 0x40095d50
+1, 270000, 22050, 0xb306d419
0, 276000, 657600, 0x40095d50
0, 282000, 657600, 0x64766320
0, 288000, 657600, 0x64766320
@@ -62,8 +62,8 @@
0, 342000, 657600, 0xf51adc49
0, 348000, 657600, 0xf51adc49
0, 354000, 657600, 0xf51adc49
-1, 360000, 22050, 0x8cbb9625
0, 360000, 657600, 0xdd47af59
+1, 360000, 22050, 0x8cbb9625
0, 366000, 657600, 0xdd47af59
0, 372000, 657600, 0xffa8acf1
0, 378000, 657600, 0x5994b059
@@ -78,8 +78,8 @@
0, 432000, 657600, 0xbe37b549
0, 438000, 657600, 0xbe37b549
0, 444000, 657600, 0x1d395bf9
-1, 450000, 22050, 0x34a11f66
0, 450000, 657600, 0x1d395bf9
+1, 450000, 22050, 0x34a11f66
0, 456000, 657600, 0x1d395bf9
0, 462000, 657600, 0x1d395bf9
0, 468000, 657600, 0x2ec36f37
@@ -94,8 +94,8 @@
0, 522000, 657600, 0x70064801
0, 528000, 657600, 0x80d54519
0, 534000, 657600, 0xe8c942b1
-1, 540000, 22050, 0x1ae81230
0, 540000, 657600, 0x830d8c24
+1, 540000, 22050, 0x1ae81230
0, 546000, 657600, 0x830d8c24
0, 552000, 657600, 0x830d8c24
0, 558000, 657600, 0xf3c4707c
@@ -110,8 +110,8 @@
0, 612000, 657600, 0x221ceecf
0, 618000, 657600, 0x221ceecf
0, 624000, 657600, 0x221ceecf
-1, 630000, 22050, 0x1217eeba
0, 630000, 657600, 0x221ceecf
+1, 630000, 22050, 0x1217eeba
0, 636000, 657600, 0x221ceecf
0, 642000, 657600, 0x221ceecf
0, 648000, 657600, 0x3bf6f39f
@@ -126,8 +126,8 @@
0, 702000, 657600, 0x41f6218d
0, 708000, 657600, 0x41f6218d
0, 714000, 657600, 0x41f6218d
-1, 720000, 22050, 0x50e70baa
0, 720000, 657600, 0xff43ec36
+1, 720000, 22050, 0x50e70baa
0, 726000, 657600, 0x0b10eb16
0, 732000, 657600, 0x0b10eb16
0, 738000, 657600, 0xbdf41aa5
@@ -142,8 +142,8 @@
0, 792000, 657600, 0x3d4ccf06
0, 798000, 657600, 0x0897d1de
0, 804000, 657600, 0x0897d1de
-1, 810000, 22050, 0xb19e89c0
0, 810000, 657600, 0x3e27e01e
+1, 810000, 22050, 0xb19e89c0
0, 816000, 657600, 0x3e27e01e
0, 822000, 657600, 0x3e27e01e
0, 828000, 657600, 0x3e27e01e
@@ -158,8 +158,8 @@
0, 882000, 657600, 0xe9967a40
0, 888000, 657600, 0xe9967a40
0, 894000, 657600, 0xe9967a40
-1, 900000, 22050, 0x78526696
0, 900000, 657600, 0x726cb6b8
+1, 900000, 22050, 0x78526696
0, 906000, 657600, 0x2960b6e8
0, 912000, 657600, 0x2960b6e8
0, 918000, 657600, 0x1637d6c8
@@ -174,8 +174,8 @@
0, 972000, 657600, 0xdfa0d6c8
0, 978000, 657600, 0xdfa0d6c8
0, 984000, 657600, 0xdfa0d6c8
-1, 990000, 22050, 0x48e3bb21
0, 990000, 657600, 0xdfa0d6c8
+1, 990000, 22050, 0x48e3bb21
0, 996000, 657600, 0xdfa0d6c8
0, 1002000, 657600, 0xdfa0d6c8
0, 1008000, 657600, 0xdfa0d6c8
@@ -190,8 +190,8 @@
0, 1062000, 657600, 0x85e87a68
0, 1068000, 657600, 0x85e87a68
0, 1074000, 657600, 0x85e87a68
-1, 1080000, 22050, 0xbc32204a
0, 1080000, 657600, 0xb0a141a8
+1, 1080000, 22050, 0xbc32204a
0, 1086000, 657600, 0xb0a141a8
0, 1092000, 657600, 0xf3333bd8
0, 1098000, 657600, 0xea090688
@@ -206,8 +206,8 @@
0, 1152000, 657600, 0xf1d2874a
0, 1158000, 657600, 0xf1d2874a
0, 1164000, 657600, 0xf1d2874a
-1, 1170000, 22050, 0xdf6f1e46
0, 1170000, 657600, 0xa58d6742
+1, 1170000, 22050, 0xdf6f1e46
0, 1176000, 657600, 0xa58d6742
0, 1182000, 657600, 0xa58d6742
0, 1188000, 657600, 0xb0cd11bb
@@ -222,8 +222,8 @@
0, 1242000, 657600, 0x97ac10bb
0, 1248000, 657600, 0x97ac10bb
0, 1254000, 657600, 0xe8b30dd3
-1, 1260000, 22050, 0x4c91da9d
0, 1260000, 657600, 0x3d0c10bb
+1, 1260000, 22050, 0x4c91da9d
0, 1266000, 657600, 0x8d2b0dd3
0, 1272000, 657600, 0x8d2b0dd3
0, 1278000, 657600, 0xa5760dd3
diff --git a/tests/ref/fate/vqa-cc b/tests/ref/fate/vqa-cc
index 5ad2916711..d7d7f10e9f 100644
--- a/tests/ref/fate/vqa-cc
+++ b/tests/ref/fate/vqa-cc
@@ -1,5 +1,5 @@
-1, 0, 22048, 0x0665d7f4
0, 0, 192000, 0x00000000
+1, 0, 22048, 0x0665d7f4
0, 6000, 192000, 0x00000000
0, 12000, 192000, 0x00000000
0, 18000, 192000, 0x00000000
diff --git a/tests/ref/fate/wmv8-drm-nodec b/tests/ref/fate/wmv8-drm-nodec
index 69bd752eb0..1a70fa5c64 100644
--- a/tests/ref/fate/wmv8-drm-nodec
+++ b/tests/ref/fate/wmv8-drm-nodec
@@ -1,5 +1,5 @@
-1, 0, 1088, 0x5cd379bb
0, 0, 282, 0x000d949a
+1, 0, 1088, 0x5cd379bb
1, 39150, 1088, 0x8dfa1368
1, 66600, 1088, 0xc0d211be
1, 92070, 1088, 0x8238113a
diff --git a/tests/ref/lavf/gxf b/tests/ref/lavf/gxf
index 4535d9a3ab..6b39c2f273 100644
--- a/tests/ref/lavf/gxf
+++ b/tests/ref/lavf/gxf
@@ -1,3 +1,3 @@
346d38d330ab5cb0caa6b5537167bc0d *./tests/data/lavf/lavf.gxf
796392 ./tests/data/lavf/lavf.gxf
-./tests/data/lavf/lavf.gxf CRC=0xad9e86eb
+./tests/data/lavf/lavf.gxf CRC=0x345f86eb
diff --git a/tests/ref/lavf/mpg b/tests/ref/lavf/mpg
index 13f95a0f1a..b81cb8a8de 100644
--- a/tests/ref/lavf/mpg
+++ b/tests/ref/lavf/mpg
@@ -1,3 +1,3 @@
dd60652c2193670abffb8c2a123a820e *./tests/data/lavf/lavf.mpg
372736 ./tests/data/lavf/lavf.mpg
-./tests/data/lavf/lavf.mpg CRC=0x2b39ed74
+./tests/data/lavf/lavf.mpg CRC=0xf361ed74
diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
index ac556f5c5d..58e75d17cd 100644
--- a/tests/ref/lavf/mxf
+++ b/tests/ref/lavf/mxf
@@ -1,6 +1,6 @@
785e38ddd2466046f30aa36399b8f8fa *./tests/data/lavf/lavf.mxf
525881 ./tests/data/lavf/lavf.mxf
-./tests/data/lavf/lavf.mxf CRC=0xb6aa0849
+./tests/data/lavf/lavf.mxf CRC=0x4ace0849
b3174e2db508564c1cce0b5e3c1bc1bd *./tests/data/lavf/lavf.mxf_d10
5330989 ./tests/data/lavf/lavf.mxf_d10
./tests/data/lavf/lavf.mxf_d10 CRC=0xc3f4f92e