aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-08 21:10:56 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-08 22:02:59 +0200
commitb4178a3f13784604281dc3da31383783676b8fec (patch)
tree5cbcf5e4bf9288ee4743e47e90a3dcacb45f3df0 /libavformat
parentb4b58485135dbc37a6cf8a57196157b1d67d13e1 (diff)
parentb2e495afa8e23b46536e25e892157104437f4020 (diff)
downloadffmpeg-b4178a3f13784604281dc3da31383783676b8fec.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: rtmp: Support 'rtmp_live', an option which specifies if the media is a live stream. av_samples_fill_array: Mark unmodified function argument as const. lagarith: add YUY2 decoding support Support decoding unaligned rgb24 lagarith. dv: Split profile handling code into a separate file. flvenc: use AVFormatContext, not AVCodecContext for logging. mov: Remove write-only variable in mov_read_chan(). fate: Change the probe-format refs to match the final text format committed. fate: Add avprobe as a make dependency Add probe fate tests to test for regressions in detecting media types. fate: Add oneline comparison method qdm2: clip array indices returned by qdm2_get_vlc(). avplay: properly close/reopen AVAudioResampleContext on channel layout change avcodec: do not needlessly set packet size to 0 in avcodec_encode_audio2() avcodec: for audio encoding, reset output packet when it is not valid avcodec: refactor avcodec_encode_audio2() to merge common branches avcodec: remove fallbacks for AVCodec.encode() in avcodec_encode_audio2() Conflicts: ffplay.c libavcodec/Makefile libavcodec/dvdata.c libavcodec/dvdata.h libavcodec/qdm2.c libavcodec/utils.c libavformat/flvenc.c libavformat/mov.c tests/Makefile Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/dv.c1
-rw-r--r--libavformat/dvenc.c1
-rw-r--r--libavformat/flvenc.c21
-rw-r--r--libavformat/mov.c4
-rw-r--r--libavformat/rtmpproto.c8
5 files changed, 22 insertions, 13 deletions
diff --git a/libavformat/dv.c b/libavformat/dv.c
index 998173479d..2ce928fa26 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -31,6 +31,7 @@
#include <time.h>
#include "avformat.h"
#include "internal.h"
+#include "libavcodec/dv_profile.h"
#include "libavcodec/dvdata.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c
index 43d654ca20..506225e8eb 100644
--- a/libavformat/dvenc.c
+++ b/libavformat/dvenc.c
@@ -32,6 +32,7 @@
#include "avformat.h"
#include "internal.h"
+#include "libavcodec/dv_profile.h"
#include "libavcodec/dvdata.h"
#include "dv.h"
#include "libavutil/fifo.h"
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 45fe1cdc18..a21d0aa166 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -68,18 +68,19 @@ typedef struct FLVStreamContext {
int64_t last_ts; ///< last timestamp for each stream
} FLVStreamContext;
-static int get_audio_flags(AVCodecContext *enc){
+static int get_audio_flags(AVFormatContext *s, AVCodecContext *enc)
+{
int flags = (enc->bits_per_coded_sample == 16) ? FLV_SAMPLESSIZE_16BIT : FLV_SAMPLESSIZE_8BIT;
if (enc->codec_id == CODEC_ID_AAC) // specs force these parameters
return FLV_CODECID_AAC | FLV_SAMPLERATE_44100HZ | FLV_SAMPLESSIZE_16BIT | FLV_STEREO;
else if (enc->codec_id == CODEC_ID_SPEEX) {
if (enc->sample_rate != 16000) {
- av_log(enc, AV_LOG_ERROR, "flv only supports wideband (16kHz) Speex audio\n");
+ av_log(s, AV_LOG_ERROR, "flv only supports wideband (16kHz) Speex audio\n");
return -1;
}
if (enc->channels != 1) {
- av_log(enc, AV_LOG_ERROR, "flv only supports mono Speex audio\n");
+ av_log(s, AV_LOG_ERROR, "flv only supports mono Speex audio\n");
return -1;
}
return FLV_CODECID_SPEEX | FLV_SAMPLERATE_11025HZ | FLV_SAMPLESSIZE_16BIT;
@@ -102,7 +103,7 @@ static int get_audio_flags(AVCodecContext *enc){
break;
}
default:
- av_log(enc, AV_LOG_ERROR, "flv does not support that sample rate, choose from (44100, 22050, 11025).\n");
+ av_log(s, AV_LOG_ERROR, "flv does not support that sample rate, choose from (44100, 22050, 11025).\n");
return -1;
}
}
@@ -140,7 +141,7 @@ static int get_audio_flags(AVCodecContext *enc){
flags |= enc->codec_tag<<4;
break;
default:
- av_log(enc, AV_LOG_ERROR, "codec not compatible with flv\n");
+ av_log(s, AV_LOG_ERROR, "codec not compatible with flv\n");
return -1;
}
@@ -198,12 +199,12 @@ static int flv_write_header(AVFormatContext *s)
}
video_enc = enc;
if(enc->codec_tag == 0) {
- av_log(enc, AV_LOG_ERROR, "video codec not compatible with flv\n");
+ av_log(s, AV_LOG_ERROR, "video codec not compatible with flv\n");
return -1;
}
} else if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
audio_enc = enc;
- if(get_audio_flags(enc)<0)
+ if (get_audio_flags(s, enc) < 0)
return -1;
}
avpriv_set_pts_info(s->streams[i], 32, 1, 1000); /* 32 bit pts in ms */
@@ -344,7 +345,7 @@ static int flv_write_header(AVFormatContext *s)
avio_wb24(pb, 0); // streamid
pos = avio_tell(pb);
if (enc->codec_id == CODEC_ID_AAC) {
- avio_w8(pb, get_audio_flags(enc));
+ avio_w8(pb, get_audio_flags(s, enc));
avio_w8(pb, 0); // AAC sequence header
avio_write(pb, enc->extradata, enc->extradata_size);
} else {
@@ -420,13 +421,13 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
flags = enc->codec_tag;
if(flags == 0) {
- av_log(enc, AV_LOG_ERROR, "video codec %s not compatible with flv\n", avcodec_get_name(enc->codec_id));
+ av_log(s, AV_LOG_ERROR, "video codec %s not compatible with flv\n", avcodec_get_name(enc->codec_id));
return -1;
}
flags |= pkt->flags & AV_PKT_FLAG_KEY ? FLV_FRAME_KEY : FLV_FRAME_INTER;
} else if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
- flags = get_audio_flags(enc);
+ flags = get_audio_flags(s, enc);
assert(size);
diff --git a/libavformat/mov.c b/libavformat/mov.c
index f8da064980..240bccf402 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -655,9 +655,9 @@ static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom)
label_mask = 0;
for (i = 0; i < num_descr; i++) {
- uint32_t av_unused label, cflags;
+ uint32_t label;
label = avio_rb32(pb); // mChannelLabel
- cflags = avio_rb32(pb); // mChannelFlags
+ avio_rb32(pb); // mChannelFlags
avio_rl32(pb); // mCoordinates[0]
avio_rl32(pb); // mCoordinates[1]
avio_rl32(pb); // mCoordinates[2]
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 521e9b8c6a..2feb2409ba 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -66,6 +66,7 @@ typedef struct RTMPContext {
int chunk_size; ///< size of the chunks RTMP packets are divided into
int is_input; ///< input/output flag
char *playpath; ///< stream identifier to play (with possible "mp4:" prefix)
+ int live; ///< 0: recorded, -1: live, -2: both
char *app; ///< name of application
ClientState state; ///< current state
int main_channel_id; ///< an additional channel ID which is used for some invocations
@@ -287,7 +288,7 @@ static void gen_play(URLContext *s, RTMPContext *rt)
av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", rt->playpath);
ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0,
- 20 + strlen(rt->playpath));
+ 29 + strlen(rt->playpath));
pkt.extra = rt->main_channel_id;
p = pkt.data;
@@ -295,6 +296,7 @@ static void gen_play(URLContext *s, RTMPContext *rt)
ff_amf_write_number(&p, ++rt->nb_invokes);
ff_amf_write_null(&p);
ff_amf_write_string(&p, rt->playpath);
+ ff_amf_write_number(&p, rt->live);
ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
ff_rtmp_packet_destroy(&pkt);
@@ -1050,6 +1052,10 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
static const AVOption rtmp_options[] = {
{"rtmp_app", "Name of application to connect to on the RTMP server", OFFSET(app), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
+ {"rtmp_live", "Specify that the media is a live stream.", OFFSET(live), AV_OPT_TYPE_INT, {-2}, INT_MIN, INT_MAX, DEC, "rtmp_live"},
+ {"any", "both", 0, AV_OPT_TYPE_CONST, {-2}, 0, 0, DEC, "rtmp_live"},
+ {"live", "live stream", 0, AV_OPT_TYPE_CONST, {-1}, 0, 0, DEC, "rtmp_live"},
+ {"recorded", "recorded stream", 0, AV_OPT_TYPE_CONST, {0}, 0, 0, DEC, "rtmp_live"},
{"rtmp_playpath", "Stream identifier to play or to publish", OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
{ NULL },
};