Commit 938adb7a authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  dwt: K&R prettyprinting cosmetics
  Remove libnut wrapper
  fate: change name of FATE samples location environment variable
  avformat: Add a flag to mark muxers that allow (non strict) monotone timestamps.
  http: Factorize the code by adding http_read_header()

Conflicts:
	configure
	doc/APIchanges
	doc/fate.texi
	libavcodec/dwt.c
	libavcodec/dwt.h
	libavformat/Makefile
	libavformat/avformat.h
	libavformat/libnut.c
	libavformat/matroskaenc.c
	libavformat/utils.c
	libavformat/version.h
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents faa2930f 13a867a6
This diff is collapsed.
......@@ -39,15 +39,16 @@ typedef struct {
int y;
} DWTCompose;
/** Used to minimize the amount of memory used in order to optimize cache performance. **/
/** Used to minimize the amount of memory used in order to
* optimize cache performance. **/
typedef struct slice_buffer_s {
IDWTELEM * * line; ///< For use by idwt and predict_slices.
IDWTELEM * * data_stack; ///< Used for internal purposes.
IDWTELEM **line; ///< For use by idwt and predict_slices.
IDWTELEM **data_stack; ///< Used for internal purposes.
int data_stack_top;
int line_count;
int line_width;
int data_count;
IDWTELEM * base_buffer; ///< Buffer that this structure is caching.
IDWTELEM *base_buffer; ///< Buffer that this structure is caching.
} slice_buffer;
struct DWTContext;
......@@ -75,9 +76,14 @@ typedef struct DWTContext {
void (*vertical_compose)(void); ///< one set of lowpass and highpass combined
void (*horizontal_compose)(IDWTELEM *b, IDWTELEM *tmp, int width);
void (*vertical_compose97i)(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width);
void (*vertical_compose97i)(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5,
int width);
void (*horizontal_compose97i)(IDWTELEM *b, int width);
void (*inner_add_yblock)(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h, int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8);
void (*inner_add_yblock)(const uint8_t *obmc, const int obmc_stride,
uint8_t **block, int b_w, int b_h, int src_x,
int src_y, int src_stride, slice_buffer *sb,
int add, uint8_t *dst8);
DWTCompose cs[MAX_DECOMPOSITIONS];
} DWTContext;
......@@ -217,27 +223,43 @@ void ff_spatial_idwt_slice2(DWTContext *d, int y);
#define W_DS 9
#endif
#define slice_buffer_get_line(slice_buf, line_num) ((slice_buf)->line[line_num] ? (slice_buf)->line[line_num] : ff_slice_buffer_load_line((slice_buf), (line_num)))
//#define slice_buffer_get_line(slice_buf, line_num) (ff_slice_buffer_load_line((slice_buf), (line_num)))
void ff_slice_buffer_init(slice_buffer * buf, int line_count, int max_allocated_lines, int line_width, IDWTELEM * base_buffer);
void ff_slice_buffer_release(slice_buffer * buf, int line);
void ff_slice_buffer_flush(slice_buffer * buf);
void ff_slice_buffer_destroy(slice_buffer * buf);
IDWTELEM * ff_slice_buffer_load_line(slice_buffer * buf, int line);
void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width);
#define slice_buffer_get_line(slice_buf, line_num) \
((slice_buf)->line[line_num] ? (slice_buf)->line[line_num] \
: ff_slice_buffer_load_line((slice_buf), \
(line_num)))
void ff_slice_buffer_init(slice_buffer *buf, int line_count,
int max_allocated_lines, int line_width,
IDWTELEM *base_buffer);
void ff_slice_buffer_release(slice_buffer *buf, int line);
void ff_slice_buffer_flush(slice_buffer *buf);
void ff_slice_buffer_destroy(slice_buffer *buf);
IDWTELEM *ff_slice_buffer_load_line(slice_buffer *buf, int line);
void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5,
int width);
void ff_snow_horizontal_compose97i(IDWTELEM *b, int width);
void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h, int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8);
int ff_w53_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h);
int ff_w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h);
void ff_spatial_dwt(int *buffer, int width, int height, int stride, int type, int decomposition_count);
void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer * sb, int width, int height, int stride_line, int type, int decomposition_count);
void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs, slice_buffer * slice_buf, int width, int height, int stride_line, int type, int decomposition_count, int y);
void ff_spatial_idwt(IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count);
void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride,
uint8_t **block, int b_w, int b_h, int src_x,
int src_y, int src_stride, slice_buffer *sb,
int add, uint8_t *dst8);
int ff_w53_32_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
int ff_w97_32_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
void ff_spatial_dwt(int *buffer, int width, int height, int stride, int type,
int decomposition_count);
void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer *sb, int width,
int height, int stride_line, int type,
int decomposition_count);
void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs,
slice_buffer *slice_buf, int width,
int height, int stride_line, int type,
int decomposition_count, int y);
void ff_spatial_idwt(IDWTELEM *buffer, int width, int height, int stride,
int type, int decomposition_count);
void ff_dwt_init(DWTContext *c);
void ff_dwt_init_x86(DWTContext *c);
......
......@@ -351,11 +351,17 @@ typedef struct AVProbeData {
#define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fallback to generic search */
#define AVFMT_NO_BYTE_SEEK 0x8000 /**< Format does not allow seeking by bytes */
#define AVFMT_ALLOW_FLUSH 0x10000 /**< Format allows flushing. If not set, the muxer will not receive a NULL packet in the write_packet function. */
#define AVFMT_SEEK_TO_PTS 0x4000000 /**< Seeking is based on PTS */
#define AVFMT_TS_NONSTRICT 0x8000000 /**< Format does not require strictly
#if LIBAVFORMAT_VERSION_MAJOR <= 54
#define AVFMT_TS_NONSTRICT 0x8020000 //we try to be compatible to the ABIs of ffmpeg and major forks
#else
#define AVFMT_TS_NONSTRICT 0x20000
#endif
/**< Format does not require strictly
increasing timestamps, but they must
still be monotonic */
#define AVFMT_SEEK_TO_PTS 0x4000000 /**< Seeking is based on PTS */
/**
* @addtogroup lavf_encoding
* @{
......@@ -377,7 +383,8 @@ typedef struct AVOutputFormat {
/**
* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE,
* AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS,
* AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH
* AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH,
* AVFMT_TS_NONSTRICT
*/
int flags;
......
......@@ -520,5 +520,6 @@ AVOutputFormat ff_flv_muxer = {
.codec_tag = (const AVCodecTag* const []){
flv_video_codec_ids, flv_audio_codec_ids, 0
},
.flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
.flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS |
AVFMT_TS_NONSTRICT,
};
......@@ -327,13 +327,35 @@ static inline int has_header(const char *str, const char *header)
return av_stristart(str, header + 2, NULL) || av_stristr(str, header);
}
static int http_read_header(URLContext *h, int *new_location)
{
HTTPContext *s = h->priv_data;
char line[1024];
int err = 0;
for (;;) {
if (http_get_line(s, line, sizeof(line)) < 0)
return AVERROR(EIO);
av_dlog(NULL, "header='%s'\n", line);
err = process_line(h, line, s->line_count, new_location);
if (err < 0)
return err;
if (err == 0)
break;
s->line_count++;
}
return err;
}
static int http_connect(URLContext *h, const char *path, const char *local_path,
const char *hoststr, const char *auth,
const char *proxyauth, int *new_location)
{
HTTPContext *s = h->priv_data;
int post, err;
char line[1024];
char headers[1024] = "";
char *authstr = NULL, *proxyauthstr = NULL;
int64_t off = s->off;
......@@ -407,19 +429,9 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
s->chunksize = -1;
/* wait for header */
for(;;) {
if (http_get_line(s, line, sizeof(line)) < 0)
return AVERROR(EIO);
av_dlog(NULL, "header='%s'\n", line);
err = process_line(h, line, s->line_count, new_location);
err = http_read_header(h, new_location);
if (err < 0)
return err;
if (err == 0)
break;
s->line_count++;
}
return (off == s->off) ? 0 : -1;
}
......@@ -607,10 +619,11 @@ static int http_proxy_open(URLContext *h, const char *uri, int flags)
HTTPContext *s = h->priv_data;
char hostname[1024], hoststr[1024];
char auth[1024], pathbuf[1024], *path;
char line[1024], lower_url[100];
char lower_url[100];
int port, ret = 0, attempts = 0;
HTTPAuthType cur_auth_type;
char *authstr;
int new_loc;
h->is_streamed = 1;
......@@ -651,30 +664,19 @@ redo:
s->filesize = -1;
cur_auth_type = s->proxy_auth_state.auth_type;
for (;;) {
int new_loc;
// Note: This uses buffering, potentially reading more than the
// HTTP header. If tunneling a protocol where the server starts
// the conversation, we might buffer part of that here, too.
// Reading that requires using the proper ffurl_read() function
// on this URLContext, not using the fd directly (as the tls
// protocol does). This shouldn't be an issue for tls though,
// since the client starts the conversation there, so there
// is no extra data that we might buffer up here.
if (http_get_line(s, line, sizeof(line)) < 0) {
ret = AVERROR(EIO);
goto fail;
}
av_dlog(h, "header='%s'\n", line);
ret = process_line(h, line, s->line_count, &new_loc);
/* Note: This uses buffering, potentially reading more than the
* HTTP header. If tunneling a protocol where the server starts
* the conversation, we might buffer part of that here, too.
* Reading that requires using the proper ffurl_read() function
* on this URLContext, not using the fd directly (as the tls
* protocol does). This shouldn't be an issue for tls though,
* since the client starts the conversation there, so there
* is no extra data that we might buffer up here.
*/
ret = http_read_header(h, &new_loc);
if (ret < 0)
goto fail;
if (ret == 0)
break;
s->line_count++;
}
attempts++;
if (s->http_code == 407 &&
(cur_auth_type == HTTP_AUTH_NONE || s->proxy_auth_state.stale) &&
......
......@@ -1324,7 +1324,8 @@ AVOutputFormat ff_matroska_muxer = {
.write_header = mkv_write_header,
.write_packet = mkv_write_packet,
.write_trailer = mkv_write_trailer,
.flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
.flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS |
AVFMT_TS_NONSTRICT,
.subtitle_codec = CODEC_ID_SSA,
.query_codec = mkv_query_codec,
};
......@@ -1342,7 +1343,8 @@ AVOutputFormat ff_webm_muxer = {
.write_header = mkv_write_header,
.write_packet = mkv_write_packet,
.write_trailer = mkv_write_trailer,
.flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
.flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS |
AVFMT_TS_NONSTRICT,
};
#endif
......@@ -1362,6 +1364,6 @@ AVOutputFormat ff_matroska_audio_muxer = {
.write_header = mkv_write_header,
.write_packet = mkv_write_packet,
.write_trailer = mkv_write_trailer,
.flags = AVFMT_GLOBALHEADER,
.flags = AVFMT_GLOBALHEADER | AVFMT_TS_NONSTRICT,
};
#endif
......@@ -104,6 +104,6 @@ AVOutputFormat ff_framemd5_muxer = {
.video_codec = CODEC_ID_RAWVIDEO,
.write_header = ff_framehash_write_header,
.write_packet = framemd5_write_packet,
.flags = AVFMT_VARIABLE_FPS,
.flags = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
};
#endif
......@@ -144,6 +144,6 @@ AVOutputFormat ff_smjpeg_muxer = {
.write_header = smjpeg_write_header,
.write_packet = smjpeg_write_packet,
.write_trailer = smjpeg_write_trailer,
.flags = AVFMT_GLOBALHEADER,
.flags = AVFMT_GLOBALHEADER | AVFMT_TS_NONSTRICT,
.codec_tag = (const AVCodecTag *const []){ ff_codec_smjpeg_video_tags, ff_codec_smjpeg_audio_tags, 0 },
};
......@@ -513,6 +513,7 @@ AVOutputFormat ff_swf_muxer = {
.write_header = swf_write_header,
.write_packet = swf_write_packet,
.write_trailer = swf_write_trailer,
.flags = AVFMT_TS_NONSTRICT,
};
#endif
#if CONFIG_AVM2_MUXER
......@@ -526,5 +527,6 @@ AVOutputFormat ff_avm2_muxer = {
.write_header = swf_write_header,
.write_packet = swf_write_packet,
.write_trailer = swf_write_trailer,
.flags = AVFMT_TS_NONSTRICT,
};
#endif
......@@ -3315,7 +3315,9 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt){
pkt->dts= st->pts_buffer[0];
}
if(st->cur_dts && st->cur_dts != AV_NOPTS_VALUE && ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) && st->cur_dts >= pkt->dts) || st->cur_dts > pkt->dts)){
if (st->cur_dts && st->cur_dts != AV_NOPTS_VALUE &&
((!(s->oformat->flags & AVFMT_TS_NONSTRICT) &&
st->cur_dts >= pkt->dts) || st->cur_dts > pkt->dts)) {
av_log(s, AV_LOG_ERROR,
"Application provided invalid, non monotonically increasing dts to muxer in stream %d: %s >= %s\n",
st->index, av_ts2str(st->cur_dts), av_ts2str(pkt->dts));
......
......@@ -30,8 +30,8 @@
#include "libavutil/avutil.h"
#define LIBAVFORMAT_VERSION_MAJOR 54
#define LIBAVFORMAT_VERSION_MINOR 5
#define LIBAVFORMAT_VERSION_MICRO 101
#define LIBAVFORMAT_VERSION_MINOR 6
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
......
......@@ -224,6 +224,7 @@ AVOutputFormat ff_wav_muxer = {
.write_header = wav_write_header,
.write_packet = wav_write_packet,
.write_trailer = wav_write_trailer,
.flags = AVFMT_TS_NONSTRICT,
.codec_tag = (const AVCodecTag* const []){ ff_codec_wav_tags, 0 },
.priv_class = &wav_muxer_class,
};
......
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