Commit 11a1033c authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master: (23 commits)
  build: cosmetics: Reorder some lists in a more logical fashion
  x86: pngdsp: Fix assembly for OS/2
  fate: add test for RTjpeg in nuv with frameheader
  rtmp: send check_bw as notification
  g723_1: clip argument for 15-bit version of normalize_bits()
  g723_1: use all LPC vectors in formant postfilter
  id3v2: Support v2.2 PIC
  avplay: fix build with lavfi disabled.
  avconv: split configuring filter configuration to a separate file.
  avconv: split option parsing into a separate file.
  mpc8: do not leave padding after last frame in buffer for the next decode call
  mpegaudioenc: list supported channel layouts.
  mpegaudiodec: don't print an error on > 1 frame in a packet.
  api-example: update to new audio encoding API.
  configure: add --enable/disable-random option
  doc: cygwin: Update list of FATE package requirements
  build: Remove all installed headers and header directories on uninstall
  build: change checkheaders to use regular build rules
  rtmp: Add a new option 'rtmp_subscribe'
  rtmp: Add support for subscribing live streams
  ...

Conflicts:
	Makefile
	common.mak
	configure
	doc/examples/decoding_encoding.c
	ffmpeg.c
	libavcodec/g723_1.c
	libavcodec/mpegaudiodec.c
	libavcodec/x86/pngdsp.asm
	libavformat/version.h
	library.mak
	tests/fate/video.mak
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 4270d8c0 5864eb42
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
*.def *.def
*.dll *.dll
*.exe *.exe
*.ho *.h.c
*.lib *.lib
*.pc *.pc
*.so *.so
......
...@@ -18,6 +18,7 @@ PROGS-$(CONFIG_FFSERVER) += ffserver ...@@ -18,6 +18,7 @@ PROGS-$(CONFIG_FFSERVER) += ffserver
PROGS := $(PROGS-yes:%=%$(EXESUF)) PROGS := $(PROGS-yes:%=%$(EXESUF))
INSTPROGS = $(PROGS-yes:%=%$(PROGSSUF)$(EXESUF)) INSTPROGS = $(PROGS-yes:%=%$(PROGSSUF)$(EXESUF))
OBJS = cmdutils.o OBJS = cmdutils.o
OBJS-ffmpeg = ffmpeg_opt.o ffmpeg_filter.o
TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64 TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
TOOLS = qt-faststart trasher TOOLS = qt-faststart trasher
...@@ -68,8 +69,9 @@ config.h: .config ...@@ -68,8 +69,9 @@ config.h: .config
SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \ SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \
ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \ ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
ALTIVEC-OBJS ARMV5TE-OBJS ARMV6-OBJS ARMVFP-OBJS MMI-OBJS \ ARMV5TE-OBJS ARMV6-OBJS ARMVFP-OBJS NEON-OBJS \
MMX-OBJS NEON-OBJS VIS-OBJS YASM-OBJS \ MMI-OBJS ALTIVEC-OBJS VIS-OBJS \
MMX-OBJS YASM-OBJS \
MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSPR1-OBJS MIPS32R2-OBJS \ MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSPR1-OBJS MIPS32R2-OBJS \
OBJS TESTOBJS OBJS TESTOBJS
......
...@@ -10,8 +10,9 @@ ifndef SUBDIR ...@@ -10,8 +10,9 @@ ifndef SUBDIR
ifndef V ifndef V
Q = @ Q = @
ECHO = printf "$(1)\t%s\n" $(2) ECHO = printf "$(1)\t%s\n" $(2)
BRIEF = CC CXX AS YASM AR LD HOSTCC STRIP CP BRIEF = CC CXX HOSTCC AS YASM AR LD STRIP CP
SILENT = DEPCC DEPAS DEPHOSTCC DEPYASM RM RANLIB SILENT = DEPCC DEPHOSTCC DEPAS DEPYASM RANLIB RM
MSG = $@ MSG = $@
M = @$(call ECHO,$(TAG),$@); M = @$(call ECHO,$(TAG),$@);
$(foreach VAR,$(BRIEF), \ $(foreach VAR,$(BRIEF), \
...@@ -98,8 +99,9 @@ DEP_LIBS := $(foreach NAME,$(FFLIBS),lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME) ...@@ -98,8 +99,9 @@ DEP_LIBS := $(foreach NAME,$(FFLIBS),lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME)
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h)) ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-) SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%) SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
HEADEROBJS := $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho)) HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
checkheaders: $(HEADEROBJS) checkheaders: $(HOBJS)
.SECONDARY: $(HOBJS:.o=.c)
alltools: $(TOOLS) alltools: $(TOOLS)
...@@ -117,8 +119,8 @@ $(TOOLOBJS): | tools ...@@ -117,8 +119,8 @@ $(TOOLOBJS): | tools
OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOSTOBJS) $(TESTOBJS) $(HEADEROBJS)) OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOSTOBJS) $(TESTOBJS) $(HEADEROBJS))
CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver *.gcno *.gcda CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver *.ho *.gcno *.gcda
DISTCLEANSUFFIXES = *.pc DISTCLEANSUFFIXES = *.pc
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d)) -include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d))
...@@ -1211,6 +1211,7 @@ HAVE_LIST=" ...@@ -1211,6 +1211,7 @@ HAVE_LIST="
alsa_asoundlib_h alsa_asoundlib_h
altivec_h altivec_h
arpa_inet_h arpa_inet_h
asm_mod_q
asm_mod_y asm_mod_y
asm_types_h asm_types_h
attribute_may_alias attribute_may_alias
...@@ -3119,6 +3120,7 @@ EOF ...@@ -3119,6 +3120,7 @@ EOF
enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"' enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
enabled vfpv3 && check_asm vfpv3 '"vmov.f32 s0, #1.0"' enabled vfpv3 && check_asm vfpv3 '"vmov.f32 s0, #1.0"'
check_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
check_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)' check_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
enabled_all armv6t2 shared !pic && enable_pic enabled_all armv6t2 shared !pic && enable_pic
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <libavutil/imgutils.h> #include <libavutil/imgutils.h>
#include <libavutil/opt.h> #include <libavutil/opt.h>
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>
#include <libavutil/audioconvert.h>
#include <libavutil/mathematics.h> #include <libavutil/mathematics.h>
#include <libavutil/samplefmt.h> #include <libavutil/samplefmt.h>
...@@ -41,6 +42,59 @@ ...@@ -41,6 +42,59 @@
#define AUDIO_INBUF_SIZE 20480 #define AUDIO_INBUF_SIZE 20480
#define AUDIO_REFILL_THRESH 4096 #define AUDIO_REFILL_THRESH 4096
/* check that a given sample format is supported by the encoder */
static int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt)
{
const enum AVSampleFormat *p = codec->sample_fmts;
while (*p != AV_SAMPLE_FMT_NONE) {
if (*p == sample_fmt)
return 1;
p++;
}
return 0;
}
/* just pick the highest supported samplerate */
static int select_sample_rate(AVCodec *codec)
{
const int *p;
int best_samplerate = 0;
if (!codec->supported_samplerates)
return 44100;
p = codec->supported_samplerates;
while (*p) {
best_samplerate = FFMAX(*p, best_samplerate);
p++;
}
return best_samplerate;
}
/* select layout with the highest channel count */
static int select_channel_layout(AVCodec *codec)
{
const uint64_t *p;
uint64_t best_ch_layout = 0;
int best_nb_channells = 0;
if (!codec->channel_layouts)
return AV_CH_LAYOUT_STEREO;
p = codec->channel_layouts;
while (*p) {
int nb_channels = av_get_channel_layout_nb_channels(*p);
if (nb_channels > best_nb_channells) {
best_ch_layout = *p;
best_nb_channells = nb_channels;
}
p++;
}
return best_ch_layout;
}
/* /*
* Audio encoding example * Audio encoding example
*/ */
...@@ -48,11 +102,13 @@ static void audio_encode_example(const char *filename) ...@@ -48,11 +102,13 @@ static void audio_encode_example(const char *filename)
{ {
AVCodec *codec; AVCodec *codec;
AVCodecContext *c= NULL; AVCodecContext *c= NULL;
int frame_size, i, j, out_size, outbuf_size; AVFrame *frame;
AVPacket pkt;
int i, j, k, ret, got_output;
int buffer_size;
FILE *f; FILE *f;
short *samples; uint16_t *samples;
float t, tincr; float t, tincr;
uint8_t *outbuf;
printf("Encode audio file %s\n", filename); printf("Encode audio file %s\n", filename);
...@@ -67,9 +123,19 @@ static void audio_encode_example(const char *filename) ...@@ -67,9 +123,19 @@ static void audio_encode_example(const char *filename)
/* put sample parameters */ /* put sample parameters */
c->bit_rate = 64000; c->bit_rate = 64000;
c->sample_rate = 44100;
c->channels = 2; /* check that the encoder supports s16 pcm input */
c->sample_fmt = AV_SAMPLE_FMT_S16; c->sample_fmt = AV_SAMPLE_FMT_S16;
if (!check_sample_fmt(codec, c->sample_fmt)) {
fprintf(stderr, "encoder does not support %s",
av_get_sample_fmt_name(c->sample_fmt));
exit(1);
}
/* select other audio parameters supported by the encoder */
c->sample_rate = select_sample_rate(codec);
c->channel_layout = select_channel_layout(codec);
c->channels = av_get_channel_layout_nb_channels(c->channel_layout);
/* open it */ /* open it */
if (avcodec_open2(c, codec, NULL) < 0) { if (avcodec_open2(c, codec, NULL) < 0) {
...@@ -77,35 +143,71 @@ static void audio_encode_example(const char *filename) ...@@ -77,35 +143,71 @@ static void audio_encode_example(const char *filename)
exit(1); exit(1);
} }
/* the codec gives us the frame size, in samples */
frame_size = c->frame_size;
samples = malloc(frame_size * 2 * c->channels);
outbuf_size = 10000;
outbuf = malloc(outbuf_size);
f = fopen(filename, "wb"); f = fopen(filename, "wb");
if (!f) { if (!f) {
fprintf(stderr, "could not open %s\n", filename); fprintf(stderr, "could not open %s\n", filename);
exit(1); exit(1);
} }
/* frame containing input raw audio */
frame = avcodec_alloc_frame();
if (!frame) {
fprintf(stderr, "could not allocate audio frame\n");
exit(1);
}
frame->nb_samples = c->frame_size;
frame->format = c->sample_fmt;
frame->channel_layout = c->channel_layout;
/* the codec gives us the frame size, in samples,
* we calculate the size of the samples buffer in bytes */
buffer_size = av_samples_get_buffer_size(NULL, c->channels, c->frame_size,
c->sample_fmt, 0);
samples = av_malloc(buffer_size);
if (!samples) {
fprintf(stderr, "could not allocate %d bytes for samples buffer\n",
buffer_size);
exit(1);
}
/* setup the data pointers in the AVFrame */
ret = avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt,
(const uint8_t*)samples, buffer_size, 0);
if (ret < 0) {
fprintf(stderr, "could not setup audio frame\n");
exit(1);
}
/* encode a single tone sound */ /* encode a single tone sound */
t = 0; t = 0;
tincr = 2 * M_PI * 440.0 / c->sample_rate; tincr = 2 * M_PI * 440.0 / c->sample_rate;
for(i=0;i<200;i++) { for(i=0;i<200;i++) {
for(j=0;j<frame_size;j++) { av_init_packet(&pkt);
pkt.data = NULL; // packet data will be allocated by the encoder
pkt.size = 0;
for (j = 0; j < c->frame_size; j++) {
samples[2*j] = (int)(sin(t) * 10000); samples[2*j] = (int)(sin(t) * 10000);
samples[2*j+1] = samples[2*j];
for (k = 1; k < c->channels; k++)
samples[2*j + k] = samples[2*j];
t += tincr; t += tincr;
} }
/* encode the samples */ /* encode the samples */
out_size = avcodec_encode_audio(c, outbuf, outbuf_size, samples); ret = avcodec_encode_audio2(c, &pkt, frame, &got_output);
fwrite(outbuf, 1, out_size, f); if (ret < 0) {
fprintf(stderr, "error encoding audio frame\n");
exit(1);
}
if (got_output) {
fwrite(pkt.data, 1, pkt.size, f);
av_free_packet(&pkt);
}
} }
fclose(f); fclose(f);
free(outbuf);
free(samples);
av_freep(&samples);
av_freep(&frame);
avcodec_close(c); avcodec_close(c);
av_free(c); av_free(c);
} }
......
...@@ -318,9 +318,9 @@ following "Devel" ones: ...@@ -318,9 +318,9 @@ following "Devel" ones:
binutils, gcc4-core, make, git, mingw-runtime, texi2html binutils, gcc4-core, make, git, mingw-runtime, texi2html
@end example @end example
And the following "Utils" one: In order to run FATE you will also need the following "Utils" packages:
@example @example
diffutils bc, diffutils
@end example @end example
Then run Then run
......
...@@ -267,6 +267,11 @@ value will be sent. ...@@ -267,6 +267,11 @@ value will be sent.
Stream identifier to play or to publish. This option overrides the Stream identifier to play or to publish. This option overrides the
parameter specified in the URI. parameter specified in the URI.
@item rtmp_subscribe
Name of live stream to subscribe to. By default no value will be sent.
It is only sent if the option is specified or if rtmp_live
is set to live.
@item rtmp_swfurl @item rtmp_swfurl
URL of the SWF player for the media. By default no value will be sent. URL of the SWF player for the media. By default no value will be sent.
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -264,6 +264,7 @@ static int scale_vector(int16_t *vector, int length) ...@@ -264,6 +264,7 @@ static int scale_vector(int16_t *vector, int length)
for (i = 0; i < length; i++) for (i = 0; i < length; i++)
max = FFMAX(max, FFABS(vector[i])); max = FFMAX(max, FFABS(vector[i]));
max = FFMIN(max, 0x7FFF);
bits = normalize_bits(max, 15); bits = normalize_bits(max, 15);
scale = shift_table[bits]; scale = shift_table[bits];
...@@ -913,6 +914,7 @@ static void formant_postfilter(G723_1_Context *p, int16_t *lpc, int16_t *buf) ...@@ -913,6 +914,7 @@ static void formant_postfilter(G723_1_Context *p, int16_t *lpc, int16_t *buf)
} }
iir_filter(filter_coef[0], filter_coef[1], buf + i, iir_filter(filter_coef[0], filter_coef[1], buf + i,
filter_signal + i, 1); filter_signal + i, 1);
lpc += LPC_ORDER;
} }
memcpy(p->fir_mem, buf + FRAME_LEN, LPC_ORDER * sizeof(int16_t)); memcpy(p->fir_mem, buf + FRAME_LEN, LPC_ORDER * sizeof(int16_t));
......
...@@ -419,6 +419,8 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data, ...@@ -419,6 +419,8 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
c->cur_frame++; c->cur_frame++;
c->last_bits_used = get_bits_count(gb); c->last_bits_used = get_bits_count(gb);
if(get_bits_left(gb) < 8) // we have only padding left
c->last_bits_used = buf_size << 3;
if(c->cur_frame >= c->frames) if(c->cur_frame >= c->frames)
c->cur_frame = 0; c->cur_frame = 0;
......
...@@ -1686,7 +1686,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr, ...@@ -1686,7 +1686,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr,
if (s->frame_size <= 0 || s->frame_size > buf_size) { if (s->frame_size <= 0 || s->frame_size > buf_size) {
av_log(avctx, AV_LOG_ERROR, "incomplete frame\n"); av_log(avctx, AV_LOG_ERROR, "incomplete frame\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
}else if(s->frame_size < buf_size){ } else if (s->frame_size < buf_size) {
av_log(avctx, AV_LOG_DEBUG, "incorrect frame size - multiple frames in buffer?\n"); av_log(avctx, AV_LOG_DEBUG, "incorrect frame size - multiple frames in buffer?\n");
buf_size= s->frame_size; buf_size= s->frame_size;
} }
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
* The simplest mpeg audio layer 2 encoder. * The simplest mpeg audio layer 2 encoder.
*/ */
#include "libavutil/audioconvert.h"
#include "avcodec.h" #include "avcodec.h"
#include "internal.h" #include "internal.h"
#include "put_bits.h" #include "put_bits.h"
...@@ -792,6 +794,9 @@ AVCodec ff_mp2_encoder = { ...@@ -792,6 +794,9 @@ AVCodec ff_mp2_encoder = {
.supported_samplerates = (const int[]){ .supported_samplerates = (const int[]){
44100, 48000, 32000, 22050, 24000, 16000, 0 44100, 48000, 32000, 22050, 24000, 16000, 0
}, },
.channel_layouts = (const uint64_t[]){ AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO,
0 },
.long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"), .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
.defaults = mp2_defaults, .defaults = mp2_defaults,
}; };
...@@ -28,7 +28,7 @@ SECTION_RODATA ...@@ -28,7 +28,7 @@ SECTION_RODATA
cextern pw_255 cextern pw_255
SECTION_TEXT 16 SECTION_TEXT
; %1 = nr. of xmm registers used ; %1 = nr. of xmm registers used
%macro ADD_BYTES_FN 1 %macro ADD_BYTES_FN 1
......
...@@ -131,6 +131,8 @@ const CodecMime ff_id3v2_mime_tags[] = { ...@@ -131,6 +131,8 @@ const CodecMime ff_id3v2_mime_tags[] = {
{"image/png" , AV_CODEC_ID_PNG}, {"image/png" , AV_CODEC_ID_PNG},
{"image/tiff", AV_CODEC_ID_TIFF}, {"image/tiff", AV_CODEC_ID_TIFF},
{"image/bmp", AV_CODEC_ID_BMP}, {"image/bmp", AV_CODEC_ID_BMP},
{"JPG", AV_CODEC_ID_MJPEG}, /* ID3v2.2 */
{"PNG" , AV_CODEC_ID_PNG}, /* ID3v2.2 */
{"", AV_CODEC_ID_NONE}, {"", AV_CODEC_ID_NONE},
}; };
......
...@@ -32,6 +32,15 @@ ...@@ -32,6 +32,15 @@
#define HMAC_IPAD_VAL 0x36 #define HMAC_IPAD_VAL 0x36
#define HMAC_OPAD_VAL 0x5C #define HMAC_OPAD_VAL 0x5C
/**
* A non-zero transaction id requires the server to send back
* a _result or _error response.
* Setting it to 0 marks the message as a notification not
* requiring feedback.
*/
#define RTMP_NOTIFICATION 0
/** /**
* emulated Flash client version - 9.0.124.2 on Linux * emulated Flash client version - 9.0.124.2 on Linux
* @{ * @{
......
...@@ -91,6 +91,7 @@ typedef struct RTMPContext { ...@@ -91,6 +91,7 @@ typedef struct RTMPContext {
char* flashver; ///< version of the flash plugin char* flashver; ///< version of the flash plugin
char* swfurl; ///< url of the swf player char* swfurl; ///< url of the swf player
char* pageurl; ///< url of the web page char* pageurl; ///< url of the web page
char* subscribe; ///< name of live stream to subscribe
int server_bw; ///< server bandwidth int server_bw; ///< server bandwidth
int client_buffer_time; ///< client buffer time in ms int client_buffer_time; ///< client buffer time in ms
int flush_interval; ///< number of packets flushed in the same request (RTMPT only) int flush_interval; ///< number of packets flushed in the same request (RTMPT only)
...@@ -572,7 +573,7 @@ static int gen_check_bw(URLContext *s, RTMPContext *rt) ...@@ -572,7 +573,7 @@ static int gen_check_bw(URLContext *s, RTMPContext *rt)
p = pkt.data; p = pkt.data;
ff_amf_write_string(&p, "_checkbw"); ff_amf_write_string(&p, "_checkbw");
ff_amf_write_number(&p, ++rt->nb_invokes); ff_amf_write_number(&p, RTMP_NOTIFICATION);
ff_amf_write_null(&p); ff_amf_write_null(&p);
ret = ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, ret = ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size,
...@@ -604,6 +605,30 @@ static int gen_bytes_read(URLContext *s, RTMPContext *rt, uint32_t ts) ...@@ -604,6 +605,30 @@ static int gen_bytes_read(URLContext *s, RTMPContext *rt, uint32_t ts)
return ret; return ret;
} }
static int gen_fcsubscribe_stream(URLContext *s, RTMPContext *rt,
const char *subscribe)
{
RTMPPacket pkt;
uint8_t *p;
int ret;
if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE,
0, 27 + strlen(subscribe))) < 0)
return ret;
p = pkt.data;
ff_amf_write_string(&p, "FCSubscribe");
ff_amf_write_number(&p, ++rt->nb_invokes);
ff_amf_write_null(&p);
ff_amf_write_string(&p, subscribe);
ret = ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size,
rt->prev_pkt[1]);
ff_rtmp_packet_destroy(&pkt);
return ret;
}
int ff_rtmp_calc_digest(const uint8_t *src, int len, int gap, int ff_rtmp_calc_digest(const uint8_t *src, int len, int gap,
const uint8_t *key, int keylen, uint8_t *dst) const uint8_t *key, int keylen, uint8_t *dst)
{ {
...@@ -1011,6 +1036,20 @@ static int handle_invoke(URLContext *s, RTMPPacket *pkt) ...@@ -1011,6 +1036,20 @@ static int handle_invoke(URLContext *s, RTMPPacket *pkt)
} }
if ((ret = gen_create_stream(s, rt)) < 0) if ((ret = gen_create_stream(s, rt)) < 0)
return ret; return ret;
if (rt->is_input) {
/* Send the FCSubscribe command when the name of live
* stream is defined by the user or if it's a live stream. */
if (rt->subscribe) {
if ((ret = gen_fcsubscribe_stream(s, rt,
rt->subscribe)) < 0)
return ret;
} else if (rt->live == -1) {
if ((ret = gen_fcsubscribe_stream(s, rt,
rt->playpath)) < 0)
return ret;
}
}
break; break;
case STATE_FCPUBLISH: case STATE_FCPUBLISH:
rt->state = STATE_CONNECTING; rt->state = STATE_CONNECTING;
...@@ -1593,115 +1632,35 @@ static const AVOption rtmp_options[] = { ...@@ -1593,115 +1632,35 @@ static const AVOption rtmp_options[] = {
{"recorded", "recorded stream", 0, AV_OPT_TYPE_CONST, {0}, 0, 0, DEC, "rtmp_live"}, {"recorded", "recorded stream", 0, AV_OPT_TYPE_CONST, {0}, 0, 0, DEC, "rtmp_live"},
{"rtmp_pageurl", "URL of the web page in which the media was embedded. By default no value will be sent.", OFFSET(pageurl), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC}, {"rtmp_pageurl", "URL of the web page in which the media was embedded. By default no value will be sent.", OFFSET(pageurl), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC},
{"rtmp_playpath", "Stream identifier to play or to publish", OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, {"rtmp_playpath", "Stream identifier to play or to publish", OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
{"rtmp_subscribe", "Name of live stream to subscribe to. Defaults to rtmp_playpath.", OFFSET(subscribe), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC},
{"rtmp_swfurl", "URL of the SWF player. By default no value will be sent", OFFSET(swfurl), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, {"rtmp_swfurl", "URL of the SWF player. By default no value will be sent", OFFSET(swfurl), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
{"rtmp_tcurl", "URL of the target stream. Defaults to proto://host[:port]/app.", OFFSET(tcurl), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, {"rtmp_tcurl", "URL of the target stream. Defaults to proto://host[:port]/app.", OFFSET(tcurl), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
{ NULL }, { NULL },
}; };
static const AVClass rtmp_class = { #define RTMP_PROTOCOL(flavor) \
.class_name = "rtmp", static const AVClass flavor##_class = { \
.item_name = av_default_item_name, .class_name = #flavor, \
.option = rtmp_options, .item_name = av_default_item_name, \
.version = LIBAVUTIL_VERSION_INT, .option = rtmp_options, \
}; .version = LIBAVUTIL_VERSION_INT, \
}; \
URLProtocol ff_rtmp_protocol = { \
.name = "rtmp", URLProtocol ff_##flavor##_protocol = { \
.url_open = rtmp_open, .name = #flavor, \
.url_read = rtmp_read, .url_open = rtmp_open, \
.url_write = rtmp_write, .url_read = rtmp_read, \
.url_close = rtmp_close, .url_write = rtmp_write, \
.priv_data_size = sizeof(RTMPContext), .url_close = rtmp_close, \
.flags = URL_PROTOCOL_FLAG_NETWORK, .priv_data_size = sizeof(RTMPContext), \
.priv_data_class= &rtmp_class, .flags = URL_PROTOCOL_FLAG_NETWORK, \
.priv_data_class= &flavor##_class, \
}; };
static const AVClass rtmpe_class = {
.class_name = "rtmpe",
.item_name = av_default_item_name,
.option = rtmp_options,
.version = LIBAVUTIL_VERSION_INT,
};
URLProtocol ff_rtmpe_protocol = {
.name = "rtmpe",
.url_open = rtmp_open,
.url_read = rtmp_read,
.url_write = rtmp_write,
.url_close = rtmp_close,
.priv_data_size = sizeof(RTMPContext),
.flags = URL_PROTOCOL_FLAG_NETWORK,
.priv_data_class = &rtmpe_class,
};
static const AVClass rtmps_class = { RTMP_PROTOCOL(rtmp)
.class_name = "rtmps", RTMP_PROTOCOL(rtmpe)
.item_name = av_default_item_name, RTMP_PROTOCOL(rtmps)
.option = rtmp_options, RTMP_PROTOCOL(rtmpt)
.version = LIBAVUTIL_VERSION_INT, RTMP_PROTOCOL(rtmpte)
}; RTMP_PROTOCOL(rtmpts)
URLProtocol ff_rtmps_protocol = {
.name = "rtmps",
.url_open = rtmp_open,
.url_read = rtmp_read,
.url_write = rtmp_write,
.url_close = rtmp_close,
.priv_data_size = sizeof(RTMPContext),
.flags = URL_PROTOCOL_FLAG_NETWORK,
.priv_data_class = &rtmps_class,
};
static const AVClass rtmpt_class = {
.class_name = "rtmpt",
.item_name = av_default_item_name,
.option = rtmp_options,
.version = LIBAVUTIL_VERSION_INT,
};
URLProtocol ff_rtmpt_protocol = {
.name = "rtmpt",
.url_open = rtmp_open,
.url_read = rtmp_read,
.url_write = rtmp_write,
.url_close = rtmp_close,
.priv_data_size = sizeof(RTMPContext),
.flags = URL_PROTOCOL_FLAG_NETWORK,
.priv_data_class = &rtmpt_class,
};
static const AVClass rtmpte_class = {
.class_name = "rtmpte",
.item_name = av_default_item_name,
.option = rtmp_options,
.version = LIBAVUTIL_VERSION_INT,
};
URLProtocol ff_rtmpte_protocol = {
.name = "rtmpte",
.url_open = rtmp_open,
.url_read = rtmp_read,
.url_write = rtmp_write,
.url_close = rtmp_close,
.priv_data_size = sizeof(RTMPContext),
.flags = URL_PROTOCOL_FLAG_NETWORK,
.priv_data_class = &rtmpte_class,
};
static const AVClass rtmpts_class = {
.class_name = "rtmpts",
.item_name = av_default_item_name,
.option = rtmp_options,
.version = LIBAVUTIL_VERSION_INT,
};
URLProtocol ff_rtmpts_protocol = {
.name = "rtmpts",
.url_open = rtmp_open,
.url_read = rtmp_read,
.url_write = rtmp_write,
.url_close = rtmp_close,
.priv_data_size = sizeof(RTMPContext),
.flags = URL_PROTOCOL_FLAG_NETWORK,
.priv_data_class = &rtmpts_class,
};
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 54 #define LIBAVFORMAT_VERSION_MAJOR 54
#define LIBAVFORMAT_VERSION_MINOR 22 #define LIBAVFORMAT_VERSION_MINOR 22
#define LIBAVFORMAT_VERSION_MICRO 102 #define LIBAVFORMAT_VERSION_MICRO 103
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \ LIBAVFORMAT_VERSION_MINOR, \
......
...@@ -97,6 +97,8 @@ static av_always_inline av_const int FASTDIV(int a, int b) ...@@ -97,6 +97,8 @@ static av_always_inline av_const int FASTDIV(int a, int b)
#endif /* HAVE_ARMV6 */ #endif /* HAVE_ARMV6 */
#if HAVE_ASM_MOD_Q
#define av_clipl_int32 av_clipl_int32_arm #define av_clipl_int32 av_clipl_int32_arm
static av_always_inline av_const int32_t av_clipl_int32_arm(int64_t a) static av_always_inline av_const int32_t av_clipl_int32_arm(int64_t a)
{ {
...@@ -110,6 +112,8 @@ static av_always_inline av_const int32_t av_clipl_int32_arm(int64_t a) ...@@ -110,6 +112,8 @@ static av_always_inline av_const int32_t av_clipl_int32_arm(int64_t a)
return x; return x;
} }
#endif /* HAVE_ASM_MOD_Q */
#endif /* HAVE_INLINE_ASM */ #endif /* HAVE_INLINE_ASM */
#endif /* AVUTIL_ARM_INTMATH_H */ #endif /* AVUTIL_ARM_INTMATH_H */
...@@ -61,6 +61,8 @@ static av_always_inline void AV_WN32(void *p, uint32_t v) ...@@ -61,6 +61,8 @@ static av_always_inline void AV_WN32(void *p, uint32_t v)
__asm__ ("str %1, %0" : "=m"(*(uint32_t *)p) : "r"(v)); __asm__ ("str %1, %0" : "=m"(*(uint32_t *)p) : "r"(v));
} }
#if HAVE_ASM_MOD_Q
#define AV_RN64 AV_RN64 #define AV_RN64 AV_RN64
static av_always_inline uint64_t AV_RN64(const void *p) static av_always_inline uint64_t AV_RN64(const void *p)
{ {
...@@ -82,6 +84,8 @@ static av_always_inline void AV_WN64(void *p, uint64_t v) ...@@ -82,6 +84,8 @@ static av_always_inline void AV_WN64(void *p, uint64_t v)
: "r"(v)); : "r"(v));
} }
#endif /* HAVE_ASM_MOD_Q */
#endif /* HAVE_INLINE_ASM */ #endif /* HAVE_INLINE_ASM */
#endif /* AVUTIL_ARM_INTREADWRITE_H */ #endif /* AVUTIL_ARM_INTREADWRITE_H */
...@@ -20,7 +20,7 @@ $(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm ...@@ -20,7 +20,7 @@ $(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
$(DEPYASM) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d) $(DEPYASM) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d)
$(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $< $(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $<
$(OBJS) $(OBJS:.o=.s) $(SUBDIR)%.ho $(TESTOBJS): CPPFLAGS += -DHAVE_AV_CONFIG_H $(OBJS) $(OBJS:.o=.s) $(SUBDIR)%.h.o $(TESTOBJS): CPPFLAGS += -DHAVE_AV_CONFIG_H
$(TESTOBJS): CPPFLAGS += -DTEST $(TESTOBJS): CPPFLAGS += -DTEST
$(SUBDIR)$(LIBNAME): $(OBJS) $(SUBDIR)$(LIBNAME): $(OBJS)
...@@ -87,7 +87,7 @@ uninstall-libs:: ...@@ -87,7 +87,7 @@ uninstall-libs::
-$(RM) "$(LIBDIR)/$(LIBNAME)" -$(RM) "$(LIBDIR)/$(LIBNAME)"
uninstall-headers:: uninstall-headers::
$(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS)) $(addprefix "$(INCINSTDIR)/",$(BUILT_HEADERS)) $(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS) $(BUILT_HEADERS))
$(RM) "$(LIBDIR)/pkgconfig/lib$(NAME).pc" $(RM) "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
-rmdir "$(INCINSTDIR)" -rmdir "$(INCINSTDIR)"
endef endef
......
...@@ -167,8 +167,14 @@ FATE_VIDEO += fate-mpeg2-field-enc ...@@ -167,8 +167,14 @@ FATE_VIDEO += fate-mpeg2-field-enc
fate-mpeg2-field-enc: CMD = framecrc -flags +bitexact -dct fastint -idct simple -i $(SAMPLES)/mpeg2/mpeg2_field_encoding.ts -an fate-mpeg2-field-enc: CMD = framecrc -flags +bitexact -dct fastint -idct simple -i $(SAMPLES)/mpeg2/mpeg2_field_encoding.ts -an
# FIXME dropped frames in this test because of coarse timebase # FIXME dropped frames in this test because of coarse timebase
FATE_VIDEO += fate-nuv FATE_NUV += fate-nuv-rtjpeg
fate-nuv: CMD = framecrc -idct simple -i $(SAMPLES)/nuv/Today.nuv -an fate-nuv-rtjpeg: CMD = framecrc -idct simple -i $(SAMPLES)/nuv/Today.nuv -an
FATE_NUV += fate-nuv-rtjpeg-fh
fate-nuv-rtjpeg-fh: CMD = framecrc -idct simple -i $(SAMPLES)/nuv/rtjpeg_frameheader.nuv -an
FATE_VIDEO += $(FATE_NUV)
fate-nuv: $(FATE_NUV)
FATE_VIDEO += fate-paf-video FATE_VIDEO += fate-paf-video
fate-paf-video: CMD = framecrc -i $(SAMPLES)/paf/hod1-partial.paf -pix_fmt rgb24 -an fate-paf-video: CMD = framecrc -i $(SAMPLES)/paf/hod1-partial.paf -pix_fmt rgb24 -an
......
dec0deb2425e908d232d2471acff04a3 *tests/data/fate/acodec-g723_1.g723_1 dec0deb2425e908d232d2471acff04a3 *tests/data/fate/acodec-g723_1.g723_1
4800 tests/data/fate/acodec-g723_1.g723_1 4800 tests/data/fate/acodec-g723_1.g723_1
87fd529c9e41914f73a865d147cc9516 *tests/data/fate/acodec-g723_1.out.wav d70776846d77c652bceed281fcca9cc8 *tests/data/fate/acodec-g723_1.out.wav
stddev: 8425.98 PSNR: 17.82 MAXDIFF:53268 bytes: 95992/ 96000 stddev: 8423.47 PSNR: 17.82 MAXDIFF:53292 bytes: 95992/ 96000
#tb 0: 1/50
0, 0, 0, 1, 221184, 0xf48c94f6
0, 2, 2, 1, 221184, 0x89b625b2
0, 3, 3, 1, 221184, 0x37e04714
0, 4, 4, 1, 221184, 0x4f4c5224
0, 5, 5, 1, 221184, 0x9193c9f1
0, 6, 6, 1, 221184, 0x5d1a6197
0, 7, 7, 1, 221184, 0x40cd51e7
0, 8, 8, 1, 221184, 0xb2c1a729
0, 10, 10, 1, 221184, 0x998d6144
0, 11, 11, 1, 221184, 0xf5d52311
0, 12, 12, 1, 221184, 0xea9dd6bf
0, 13, 13, 1, 221184, 0x0e2ed854
0, 14, 14, 1, 221184, 0xe295ba58
0, 15, 15, 1, 221184, 0x8aedbb69
0, 16, 16, 1, 221184, 0x253c9aaa
0, 17, 17, 1, 221184, 0x5eaf9fb1
0, 18, 18, 1, 221184, 0xcdb5a0cb
0, 19, 19, 1, 221184, 0xcdb5a0cb
0, 20, 20, 1, 221184, 0x23f89994
0, 21, 21, 1, 221184, 0x23f89994
0, 22, 22, 1, 221184, 0x10dc98d6
0, 23, 23, 1, 221184, 0x799b9d98
0, 24, 24, 1, 221184, 0xb226996c
0, 25, 25, 1, 221184, 0x0ac59a42
0, 26, 26, 1, 221184, 0x87c2a654
0, 27, 27, 1, 221184, 0xf4c1a711
0, 28, 28, 1, 221184, 0xf60fa72e
0, 29, 29, 1, 221184, 0xc8f8b6fc
0, 30, 30, 1, 221184, 0xd709b813
0, 31, 31, 1, 221184, 0x5fdfb76b
0, 32, 32, 1, 221184, 0x5798b0aa
0, 33, 33, 1, 221184, 0xf572b1c3
0, 34, 34, 1, 221184, 0x14b0afdf
0, 35, 35, 1, 221184, 0x0a66b5b8
0, 36, 36, 1, 221184, 0xe316c620
0, 37, 37, 1, 221184, 0xbc76c5c2
0, 38, 38, 1, 221184, 0x77c7c5e5
0, 39, 39, 1, 221184, 0xfc7ac63e
0, 40, 40, 1, 221184, 0x05a29ffe
0, 41, 41, 1, 221184, 0x9bffbf6c
0, 42, 42, 1, 221184, 0x3c55be40
0, 43, 43, 1, 221184, 0x6f46c14e
0, 44, 44, 1, 221184, 0x9cf4ae70
0, 45, 45, 1, 221184, 0xf205b2f8
0, 46, 46, 1, 221184, 0x7180aff8
0, 47, 47, 1, 221184, 0x125eaffe
0, 48, 48, 1, 221184, 0x6970a32d
0, 49, 49, 1, 221184, 0xaea79f62
0, 50, 50, 1, 221184, 0x48d2a093
0, 51, 51, 1, 221184, 0x10a59eb5
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