* commit 'a25d912dca9cd553440167e0476c47581359c0fc': avcodec_encode_audio(): fix invalid free pcm-mpeg: correct bitrate calculation ffv1: K&R formatting cosmetics fate: Add rangecoder test network: #include stdint.h in network.h nut: export codec_tag provided by rawvideo avserver: move avserver-specific code from ffmdec.c to avserver.c Conflicts: ffserver.c libavcodec/ffv1.c libavformat/ffmdec.c libavformat/nutenc.c tests/ref/lavfi/crop tests/ref/lavfi/crop_scale tests/ref/lavfi/crop_scale_vflip tests/ref/lavfi/crop_vflip tests/ref/lavfi/null tests/ref/lavfi/pixdesc tests/ref/lavfi/pixfmts_copy tests/ref/lavfi/pixfmts_crop tests/ref/lavfi/pixfmts_hflip tests/ref/lavfi/pixfmts_null tests/ref/lavfi/pixfmts_pad tests/ref/lavfi/pixfmts_scale tests/ref/lavfi/pixfmts_vflip tests/ref/lavfi/scale200 tests/ref/lavfi/scale500 tests/ref/lavfi/vflip tests/ref/lavfi/vflip_crop tests/ref/lavfi/vflip_vflip Merged-by: Michael Niedermayer <michaelni@gmx.at>tags/n1.1
| @@ -44,6 +44,7 @@ | |||||
| #include "libavutil/avstring.h" | #include "libavutil/avstring.h" | ||||
| #include "libavutil/lfg.h" | #include "libavutil/lfg.h" | ||||
| #include "libavutil/dict.h" | #include "libavutil/dict.h" | ||||
| #include "libavutil/intreadwrite.h" | |||||
| #include "libavutil/mathematics.h" | #include "libavutil/mathematics.h" | ||||
| #include "libavutil/random_seed.h" | #include "libavutil/random_seed.h" | ||||
| #include "libavutil/parseutils.h" | #include "libavutil/parseutils.h" | ||||
| @@ -328,6 +329,37 @@ static AVLFG random_state; | |||||
| static FILE *logfile = NULL; | static FILE *logfile = NULL; | ||||
| static int64_t ffm_read_write_index(int fd) | |||||
| { | |||||
| uint8_t buf[8]; | |||||
| lseek(fd, 8, SEEK_SET); | |||||
| if (read(fd, buf, 8) != 8) | |||||
| return AVERROR(EIO); | |||||
| return AV_RB64(buf); | |||||
| } | |||||
| static int ffm_write_write_index(int fd, int64_t pos) | |||||
| { | |||||
| uint8_t buf[8]; | |||||
| int i; | |||||
| for(i=0;i<8;i++) | |||||
| buf[i] = (pos >> (56 - i * 8)) & 0xff; | |||||
| lseek(fd, 8, SEEK_SET); | |||||
| if (write(fd, buf, 8) != 8) | |||||
| return AVERROR(EIO); | |||||
| return 8; | |||||
| } | |||||
| static void ffm_set_write_index(AVFormatContext *s, int64_t pos, | |||||
| int64_t file_size) | |||||
| { | |||||
| FFMContext *ffm = s->priv_data; | |||||
| ffm->write_index = pos; | |||||
| ffm->file_size = file_size; | |||||
| } | |||||
| /* FIXME: make ffserver work with IPv6 */ | /* FIXME: make ffserver work with IPv6 */ | ||||
| /* resolve host with also IP address parsing */ | /* resolve host with also IP address parsing */ | ||||
| static int resolve_host(struct in_addr *sin_addr, const char *hostname) | static int resolve_host(struct in_addr *sin_addr, const char *hostname) | ||||
| @@ -110,12 +110,12 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx, | |||||
| return -1; | return -1; | ||||
| } | } | ||||
| avctx->bit_rate = avctx->channels * avctx->sample_rate * | |||||
| avctx->bit_rate = FFALIGN(avctx->channels, 2) * avctx->sample_rate * | |||||
| avctx->bits_per_coded_sample; | avctx->bits_per_coded_sample; | ||||
| if (avctx->debug & FF_DEBUG_PICT_INFO) | if (avctx->debug & FF_DEBUG_PICT_INFO) | ||||
| av_dlog(avctx, | av_dlog(avctx, | ||||
| "pcm_bluray_parse_header: %d channels, %d bits per sample, %d kHz, %d kbit\n", | |||||
| "pcm_bluray_parse_header: %d channels, %d bits per sample, %d Hz, %d bit/s\n", | |||||
| avctx->channels, avctx->bits_per_coded_sample, | avctx->channels, avctx->bits_per_coded_sample, | ||||
| avctx->sample_rate, avctx->bit_rate); | avctx->sample_rate, avctx->bit_rate); | ||||
| return 0; | return 0; | ||||
| @@ -1284,7 +1284,7 @@ int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx, | |||||
| const short *samples) | const short *samples) | ||||
| { | { | ||||
| AVPacket pkt; | AVPacket pkt; | ||||
| AVFrame frame0; | |||||
| AVFrame frame0 = { 0 }; | |||||
| AVFrame *frame; | AVFrame *frame; | ||||
| int ret, samples_size, got_packet; | int ret, samples_size, got_packet; | ||||
| @@ -57,8 +57,4 @@ typedef struct FFMContext { | |||||
| int64_t start_time; | int64_t start_time; | ||||
| } FFMContext; | } FFMContext; | ||||
| int64_t ffm_read_write_index(int fd); | |||||
| int ffm_write_write_index(int fd, int64_t pos); | |||||
| void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size); | |||||
| #endif /* AVFORMAT_FFM_H */ | #endif /* AVFORMAT_FFM_H */ | ||||
| @@ -25,39 +25,6 @@ | |||||
| #include "internal.h" | #include "internal.h" | ||||
| #include "ffm.h" | #include "ffm.h" | ||||
| #include "avio_internal.h" | #include "avio_internal.h" | ||||
| #if CONFIG_FFSERVER | |||||
| #include <unistd.h> | |||||
| int64_t ffm_read_write_index(int fd) | |||||
| { | |||||
| uint8_t buf[8]; | |||||
| lseek(fd, 8, SEEK_SET); | |||||
| if (read(fd, buf, 8) != 8) | |||||
| return AVERROR(EIO); | |||||
| return AV_RB64(buf); | |||||
| } | |||||
| int ffm_write_write_index(int fd, int64_t pos) | |||||
| { | |||||
| uint8_t buf[8]; | |||||
| int i; | |||||
| for(i=0;i<8;i++) | |||||
| buf[i] = (pos >> (56 - i * 8)) & 0xff; | |||||
| lseek(fd, 8, SEEK_SET); | |||||
| if (write(fd, buf, 8) != 8) | |||||
| return AVERROR(EIO); | |||||
| return 8; | |||||
| } | |||||
| void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size) | |||||
| { | |||||
| FFMContext *ffm = s->priv_data; | |||||
| ffm->write_index = pos; | |||||
| ffm->file_size = file_size; | |||||
| } | |||||
| #endif // CONFIG_FFSERVER | |||||
| static int ffm_is_avail_data(AVFormatContext *s, int size) | static int ffm_is_avail_data(AVFormatContext *s, int size) | ||||
| { | { | ||||
| @@ -22,6 +22,7 @@ | |||||
| #define AVFORMAT_NETWORK_H | #define AVFORMAT_NETWORK_H | ||||
| #include <errno.h> | #include <errno.h> | ||||
| #include <stdint.h> | |||||
| #include "config.h" | #include "config.h" | ||||
| #include "libavutil/error.h" | #include "libavutil/error.h" | ||||
| @@ -7,4 +7,10 @@ FATE_LIBAVCODEC += fate-iirfilter | |||||
| fate-iirfilter: libavcodec/iirfilter-test$(EXESUF) | fate-iirfilter: libavcodec/iirfilter-test$(EXESUF) | ||||
| fate-iirfilter: CMD = run libavcodec/iirfilter-test | fate-iirfilter: CMD = run libavcodec/iirfilter-test | ||||
| FATE_LIBAVCODEC += fate-rangecoder | |||||
| fate-rangecoder: libavcodec/rangecoder-test$(EXESUF) | |||||
| fate-rangecoder: CMD = run libavcodec/rangecoder-test | |||||
| fate-rangecoder: CMP = null | |||||
| fate-rangecoder: REF = /dev/null | |||||
| fate-libavcodec: $(FATE_LIBAVCODEC) | fate-libavcodec: $(FATE_LIBAVCODEC) | ||||