mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Merge remote-tracking branch 'newdev/master'
* newdev/master: rtsp: Use GET_PARAMETER for keep-alive for generic RTSP servers mlp_parse.c: set AVCodecContext channel_layout APIChanges: mark the place where 0.6 was branched. avio: make get_checksum() internal. avio: move ff_crc04C11DB7_update() from avio.h -> avio_internal.h avio: make init_checksum() internal. NOT MERGED Add MxPEG decoder NOT MERGED Add support for picture_ptr field in MJpegDecodeContext NOT MERGED Move MJPEG's input buffer preprocessing in separate public function NOT MERGED Support reference picture defined by bitmask in MJPEG's SOS decoder sndio bug fix Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
1caa4123bd
@ -462,16 +462,22 @@ API changes, most recent first:
|
||||
|
||||
2010-05-26 - r23334 - lavc 52.72.0 - CODEC_CAP_EXPERIMENTAL
|
||||
Add CODEC_CAP_EXPERIMENTAL flag.
|
||||
NOTE: this was backported to 0.6
|
||||
|
||||
2010-05-23 - r23255 - lavu 50.16.0 - av_get_random_seed()
|
||||
Add av_get_random_seed().
|
||||
|
||||
2010-05-18 - r23161 - lavf 52.63.0 - AVFMT_FLAG_RTP_HINT
|
||||
Add AVFMT_FLAG_RTP_HINT as possible value for AVFormatContext.flags.
|
||||
NOTE: this was backported to 0.6
|
||||
|
||||
2010-05-09 - r23066 - lavfi 1.20.0 - AVFilterPicRef
|
||||
Add interlaced and top_field_first fields to AVFilterPicRef.
|
||||
|
||||
------------------------------8<-------------------------------------
|
||||
0.6 branch was cut here
|
||||
----------------------------->8--------------------------------------
|
||||
|
||||
2010-05-01 - r23002 - lavf 52.62.0 - probe function
|
||||
Add av_probe_input_format2 to API, it allows ignoring probe
|
||||
results below given score and returns the actual probe score.
|
||||
|
@ -42,11 +42,52 @@ static const uint8_t mlp_channels[32] = {
|
||||
5, 6, 5, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
static const uint64_t mlp_layout[32] = {
|
||||
AV_CH_LAYOUT_MONO,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
AV_CH_LAYOUT_2_1,
|
||||
AV_CH_LAYOUT_2_2,
|
||||
AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY,
|
||||
AV_CH_LAYOUT_2_1|AV_CH_LOW_FREQUENCY,
|
||||
AV_CH_LAYOUT_2_2|AV_CH_LOW_FREQUENCY,
|
||||
AV_CH_LAYOUT_SURROUND,
|
||||
AV_CH_LAYOUT_4POINT0,
|
||||
AV_CH_LAYOUT_5POINT0,
|
||||
AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY,
|
||||
AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY,
|
||||
AV_CH_LAYOUT_5POINT1,
|
||||
AV_CH_LAYOUT_4POINT0,
|
||||
AV_CH_LAYOUT_5POINT0,
|
||||
AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY,
|
||||
AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY,
|
||||
AV_CH_LAYOUT_5POINT1,
|
||||
AV_CH_LAYOUT_2_2|AV_CH_LOW_FREQUENCY,
|
||||
AV_CH_LAYOUT_5POINT0,
|
||||
AV_CH_LAYOUT_5POINT1,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const uint8_t thd_chancount[13] = {
|
||||
// LR C LFE LRs LRvh LRc LRrs Cs Ts LRsd LRw Cvh LFE2
|
||||
2, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1
|
||||
};
|
||||
|
||||
static const uint64_t thd_layout[13] = {
|
||||
AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT, // LR
|
||||
AV_CH_FRONT_CENTER, // C
|
||||
AV_CH_LOW_FREQUENCY, // LFE
|
||||
AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, // LRs
|
||||
AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT, // LRvh
|
||||
AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, // LRc
|
||||
AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT, // LRrs
|
||||
AV_CH_BACK_CENTER, // Cs
|
||||
AV_CH_TOP_BACK_CENTER, // Ts
|
||||
AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, // LRsd
|
||||
AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER, // LRw
|
||||
AV_CH_TOP_BACK_CENTER, // Cvh
|
||||
AV_CH_LOW_FREQUENCY // LFE2
|
||||
};
|
||||
|
||||
static int mlp_samplerate(int in)
|
||||
{
|
||||
if (in == 0xF)
|
||||
@ -65,6 +106,16 @@ static int truehd_channels(int chanmap)
|
||||
return channels;
|
||||
}
|
||||
|
||||
static int64_t truehd_layout(int chanmap)
|
||||
{
|
||||
int layout = 0, i;
|
||||
|
||||
for (i = 0; i < 13; i++)
|
||||
layout |= thd_layout[i] * ((chanmap >> i) & 1);
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
/** Read a major sync info header - contains high level information about
|
||||
* the stream - sample rate, channel arrangement etc. Most of this
|
||||
* information is not actually necessary for decoding, only for playback.
|
||||
@ -264,12 +315,16 @@ static int mlp_parse(AVCodecParserContext *s,
|
||||
if (mh.stream_type == 0xbb) {
|
||||
/* MLP stream */
|
||||
avctx->channels = mlp_channels[mh.channels_mlp];
|
||||
avctx->channel_layout = mlp_layout[mh.channels_mlp];
|
||||
} else { /* mh.stream_type == 0xba */
|
||||
/* TrueHD stream */
|
||||
if (mh.channels_thd_stream2)
|
||||
if (mh.channels_thd_stream2) {
|
||||
avctx->channels = truehd_channels(mh.channels_thd_stream2);
|
||||
else
|
||||
avctx->channel_layout = truehd_layout(mh.channels_thd_stream2);
|
||||
} else {
|
||||
avctx->channels = truehd_channels(mh.channels_thd_stream1);
|
||||
avctx->channel_layout = truehd_layout(mh.channels_thd_stream1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!mh.is_vbr) /* Stream is CBR */
|
||||
|
@ -447,6 +447,11 @@ attribute_deprecated int url_ferror(AVIOContext *s);
|
||||
|
||||
attribute_deprecated int udp_set_remote_url(URLContext *h, const char *uri);
|
||||
attribute_deprecated int udp_get_local_port(URLContext *h);
|
||||
|
||||
attribute_deprecated void init_checksum(AVIOContext *s,
|
||||
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
|
||||
unsigned long checksum);
|
||||
attribute_deprecated unsigned long get_checksum(AVIOContext *s);
|
||||
#endif
|
||||
|
||||
AVIOContext *avio_alloc_context(
|
||||
@ -670,13 +675,6 @@ int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
|
||||
*/
|
||||
int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
|
||||
|
||||
unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
|
||||
unsigned int len);
|
||||
unsigned long get_checksum(AVIOContext *s);
|
||||
void init_checksum(AVIOContext *s,
|
||||
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
|
||||
unsigned long checksum);
|
||||
|
||||
#if FF_API_UDP_GET_FILE
|
||||
int udp_get_file_handle(URLContext *h);
|
||||
#endif
|
||||
|
@ -74,5 +74,11 @@ int64_t ffio_read_seek (AVIOContext *h, int stream_index,
|
||||
int ff_udp_set_remote_url(URLContext *h, const char *uri);
|
||||
int ff_udp_get_local_port(URLContext *h);
|
||||
|
||||
void ffio_init_checksum(AVIOContext *s,
|
||||
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
|
||||
unsigned long checksum);
|
||||
unsigned long ffio_get_checksum(AVIOContext *s);
|
||||
unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
|
||||
unsigned int len);
|
||||
|
||||
#endif // AVFORMAT_AVIO_INTERNAL_H
|
||||
|
@ -415,6 +415,16 @@ int64_t av_url_read_fseek(AVIOContext *s, int stream_index,
|
||||
{
|
||||
return ffio_read_seek(s, stream_index, timestamp, flags);
|
||||
}
|
||||
void init_checksum(AVIOContext *s,
|
||||
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
|
||||
unsigned long checksum)
|
||||
{
|
||||
ffio_init_checksum(s, update_checksum, checksum);
|
||||
}
|
||||
unsigned long get_checksum(AVIOContext *s)
|
||||
{
|
||||
return ffio_get_checksum(s);
|
||||
}
|
||||
#endif
|
||||
|
||||
int avio_put_str(AVIOContext *s, const char *str)
|
||||
@ -557,14 +567,14 @@ unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
|
||||
return av_crc(av_crc_get_table(AV_CRC_32_IEEE), checksum, buf, len);
|
||||
}
|
||||
|
||||
unsigned long get_checksum(AVIOContext *s)
|
||||
unsigned long ffio_get_checksum(AVIOContext *s)
|
||||
{
|
||||
s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_ptr - s->checksum_ptr);
|
||||
s->update_checksum= NULL;
|
||||
return s->checksum;
|
||||
}
|
||||
|
||||
void init_checksum(AVIOContext *s,
|
||||
void ffio_init_checksum(AVIOContext *s,
|
||||
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
|
||||
unsigned long checksum)
|
||||
{
|
||||
|
@ -104,14 +104,14 @@ static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_chec
|
||||
startcode= av_be2ne64(startcode);
|
||||
startcode= ff_crc04C11DB7_update(0, (uint8_t*)&startcode, 8);
|
||||
|
||||
init_checksum(bc, ff_crc04C11DB7_update, startcode);
|
||||
ffio_init_checksum(bc, ff_crc04C11DB7_update, startcode);
|
||||
size= ffio_read_varlen(bc);
|
||||
if(size > 4096)
|
||||
avio_rb32(bc);
|
||||
if(get_checksum(bc) && size > 4096)
|
||||
if(ffio_get_checksum(bc) && size > 4096)
|
||||
return -1;
|
||||
|
||||
init_checksum(bc, calculate_checksum ? ff_crc04C11DB7_update : NULL, 0);
|
||||
ffio_init_checksum(bc, calculate_checksum ? ff_crc04C11DB7_update : NULL, 0);
|
||||
|
||||
return size;
|
||||
}
|
||||
@ -285,7 +285,7 @@ static int decode_main_header(NUTContext *nut){
|
||||
assert(nut->header_len[0]==0);
|
||||
}
|
||||
|
||||
if(skip_reserved(bc, end) || get_checksum(bc)){
|
||||
if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
|
||||
av_log(s, AV_LOG_ERROR, "main header checksum mismatch\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@ -374,7 +374,7 @@ static int decode_stream_header(NUTContext *nut){
|
||||
ffio_read_varlen(bc); // samplerate_den
|
||||
GET_V(st->codec->channels, tmp > 0)
|
||||
}
|
||||
if(skip_reserved(bc, end) || get_checksum(bc)){
|
||||
if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
|
||||
av_log(s, AV_LOG_ERROR, "stream header %d checksum mismatch\n", stream_id);
|
||||
return -1;
|
||||
}
|
||||
@ -469,7 +469,7 @@ static int decode_info_header(NUTContext *nut){
|
||||
}
|
||||
}
|
||||
|
||||
if(skip_reserved(bc, end) || get_checksum(bc)){
|
||||
if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
|
||||
av_log(s, AV_LOG_ERROR, "info header checksum mismatch\n");
|
||||
return -1;
|
||||
}
|
||||
@ -493,7 +493,7 @@ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){
|
||||
|
||||
ff_nut_reset_ts(nut, nut->time_base[tmp % nut->time_base_count], tmp / nut->time_base_count);
|
||||
|
||||
if(skip_reserved(bc, end) || get_checksum(bc)){
|
||||
if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
|
||||
av_log(s, AV_LOG_ERROR, "sync point checksum mismatch\n");
|
||||
return -1;
|
||||
}
|
||||
@ -590,7 +590,7 @@ static int find_and_decode_index(NUTContext *nut){
|
||||
}
|
||||
}
|
||||
|
||||
if(skip_reserved(bc, end) || get_checksum(bc)){
|
||||
if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
|
||||
av_log(s, AV_LOG_ERROR, "index checksum mismatch\n");
|
||||
goto fail;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "libavcodec/mpegaudiodata.h"
|
||||
#include "nut.h"
|
||||
#include "internal.h"
|
||||
#include "avio_internal.h"
|
||||
|
||||
static int find_expected_header(AVCodecContext *c, int size, int key_frame, uint8_t out[64]){
|
||||
int sample_rate= c->sample_rate;
|
||||
@ -284,17 +285,17 @@ static void put_packet(NUTContext *nut, AVIOContext *bc, AVIOContext *dyn_bc, in
|
||||
int forw_ptr= dyn_size + 4*calculate_checksum;
|
||||
|
||||
if(forw_ptr > 4096)
|
||||
init_checksum(bc, ff_crc04C11DB7_update, 0);
|
||||
ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
|
||||
avio_wb64(bc, startcode);
|
||||
ff_put_v(bc, forw_ptr);
|
||||
if(forw_ptr > 4096)
|
||||
avio_wl32(bc, get_checksum(bc));
|
||||
avio_wl32(bc, ffio_get_checksum(bc));
|
||||
|
||||
if(calculate_checksum)
|
||||
init_checksum(bc, ff_crc04C11DB7_update, 0);
|
||||
ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
|
||||
avio_write(bc, dyn_buf, dyn_size);
|
||||
if(calculate_checksum)
|
||||
avio_wl32(bc, get_checksum(bc));
|
||||
avio_wl32(bc, ffio_get_checksum(bc));
|
||||
|
||||
av_free(dyn_buf);
|
||||
}
|
||||
@ -806,7 +807,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
|
||||
needed_flags= get_needed_flags(nut, nus, fc, pkt);
|
||||
header_idx= fc->header_idx;
|
||||
|
||||
init_checksum(bc, ff_crc04C11DB7_update, 0);
|
||||
ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
|
||||
avio_w8(bc, frame_code);
|
||||
if(flags & FLAG_CODED){
|
||||
ff_put_v(bc, (flags^needed_flags) & ~(FLAG_CODED));
|
||||
@ -817,8 +818,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
|
||||
if(flags & FLAG_SIZE_MSB) ff_put_v(bc, pkt->size / fc->size_mul);
|
||||
if(flags & FLAG_HEADER_IDX) ff_put_v(bc, header_idx= best_header_idx);
|
||||
|
||||
if(flags & FLAG_CHECKSUM) avio_wl32(bc, get_checksum(bc));
|
||||
else get_checksum(bc);
|
||||
if(flags & FLAG_CHECKSUM) avio_wl32(bc, ffio_get_checksum(bc));
|
||||
else ffio_get_checksum(bc);
|
||||
|
||||
avio_write(bc, pkt->data + nut->header_len[header_idx], pkt->size - nut->header_len[header_idx]);
|
||||
nus->last_flags= flags;
|
||||
|
@ -68,7 +68,7 @@ typedef struct {
|
||||
static void ogg_update_checksum(AVFormatContext *s, AVIOContext *pb, int64_t crc_offset)
|
||||
{
|
||||
int64_t pos = avio_tell(pb);
|
||||
uint32_t checksum = get_checksum(pb);
|
||||
uint32_t checksum = ffio_get_checksum(pb);
|
||||
avio_seek(pb, crc_offset, SEEK_SET);
|
||||
avio_wb32(pb, checksum);
|
||||
avio_seek(pb, pos, SEEK_SET);
|
||||
@ -85,7 +85,7 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags)
|
||||
ret = url_open_dyn_buf(&pb);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
init_checksum(pb, ff_crc04C11DB7_update, 0);
|
||||
ffio_init_checksum(pb, ff_crc04C11DB7_update, 0);
|
||||
ffio_wfourcc(pb, "OggS");
|
||||
avio_w8(pb, 0);
|
||||
avio_w8(pb, page->flags | extra_flags);
|
||||
|
@ -340,7 +340,7 @@ retry:
|
||||
|
||||
/* send dummy request to keep TCP connection alive */
|
||||
if ((av_gettime() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2) {
|
||||
if (rt->server_type == RTSP_SERVER_WMS) {
|
||||
if (rt->server_type != RTSP_SERVER_REAL) {
|
||||
ff_rtsp_send_cmd_async(s, "GET_PARAMETER", rt->control_uri, NULL);
|
||||
} else {
|
||||
ff_rtsp_send_cmd_async(s, "OPTIONS", "*", NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user