Commit 45fb6474 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  bitstream: Properly promote av_reverse values before shifting.
  libavutil/swscale: YUV444P10/YUV444P9 support.
  H.264: Fix high bit depth explicit biweight
  h264: Fix 10-bit H.264 x86 chroma v loopfilter asm.
  Replace DEBUG_SEEK/DEBUG_SI + av_log combinations by av_dlog.
  Update copyright year for ac3enc_opts_template.c.
  adts: Adjust frame size mask to follow the specification.
  movenc: Add RTP muxer/hinter options
  movenc: Pass the RTP AVFormatContext to the SDP generation
  rtspenc: Add RTP muxer options
  rtspenc: Add an AVClass for setting muxer specific options
  rtpenc_chain: Pass the rtpflags options through to the chained muxer
  rtpenc: Declare the rtp flags private AVOptions in rtpenc.h
  sdp: Reindent after the previous commit
  rtpenc: MP4A-LATM payload support
  avoptions: Add an av_opt_flag_is_set function for inspecting flag fields
  sdp: Allow passing an AVFormatContext to the SDP generation
  mov: Fix wrong timestamp generation for fragmented movies that have time offset caused by the first edit list entry.
  mpeg12: more advanced ffmpeg mpeg2 aspect guessing code.
  swscale: split YUYV output out of yuv2packed[12X]_c().

Conflicts:
	doc/APIchanges
	libavcodec/Makefile
	libavcodec/h264dsp_template.c
	libavcodec/mpeg12.c
	libavformat/aacdec.c
	libavformat/avidec.c
	libavformat/internal.h
	libavformat/movenc.c
	libavformat/rtpenc.c
	libavformat/rtpenc_latm.c
	libavformat/sdp.c
	libavformat/version.h
	libavutil/avutil.h
	libavutil/pixfmt.h
	libswscale/swscale.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 39dbe9b6 19d824e4
...@@ -13,6 +13,9 @@ libavutil: 2011-04-18 ...@@ -13,6 +13,9 @@ libavutil: 2011-04-18
API changes, most recent first: API changes, most recent first:
2011-06-xx - xxxxxxx - lavu 51.6.0 - opt.h
Add av_opt_flag_is_set().
2011-06-10 - c381960 - lavfi 2.15.0 - avfilter_get_audio_buffer_ref_from_arrays 2011-06-10 - c381960 - lavfi 2.15.0 - avfilter_get_audio_buffer_ref_from_arrays
Add avfilter_get_audio_buffer_ref_from_arrays() to avfilter.h. Add avfilter_get_audio_buffer_ref_from_arrays() to avfilter.h.
......
...@@ -558,7 +558,7 @@ OBJS-$(CONFIG_OGG_DEMUXER) += flacdec.o flacdata.o flac.o \ ...@@ -558,7 +558,7 @@ OBJS-$(CONFIG_OGG_DEMUXER) += flacdec.o flacdata.o flac.o \
dirac.o mpeg12data.o vorbis_data.o dirac.o mpeg12data.o vorbis_data.o
OBJS-$(CONFIG_OGG_MUXER) += xiph.o flacdec.o flacdata.o flac.o \ OBJS-$(CONFIG_OGG_MUXER) += xiph.o flacdec.o flacdata.o flac.o \
vorbis_data.o vorbis_data.o
OBJS-$(CONFIG_RTP_MUXER) += mpegvideo.o xiph.o OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o mpegvideo.o xiph.o
OBJS-$(CONFIG_SPDIF_DEMUXER) += aacadtsdec.o mpeg4audio.o OBJS-$(CONFIG_SPDIF_DEMUXER) += aacadtsdec.o mpeg4audio.o
OBJS-$(CONFIG_WEBM_MUXER) += xiph.o mpeg4audio.o \ OBJS-$(CONFIG_WEBM_MUXER) += xiph.o mpeg4audio.o \
flacdec.o flacdata.o flac.o \ flacdec.o flacdata.o flac.o \
......
/* /*
* AC-3 encoder options * AC-3 encoder options
* Copyright (c) 2010 Justin Ruggles <justin.ruggles@gmail.com> * Copyright (c) 2011 Justin Ruggles <justin.ruggles@gmail.com>
* *
* This file is part of FFmpeg. * This file is part of FFmpeg.
* *
......
...@@ -118,10 +118,10 @@ static int alloc_table(VLC *vlc, int size, int use_static) ...@@ -118,10 +118,10 @@ static int alloc_table(VLC *vlc, int size, int use_static)
} }
static av_always_inline uint32_t bitswap_32(uint32_t x) { static av_always_inline uint32_t bitswap_32(uint32_t x) {
return av_reverse[x&0xFF]<<24 return (uint32_t)av_reverse[x&0xFF]<<24
| av_reverse[(x>>8)&0xFF]<<16 | (uint32_t)av_reverse[(x>>8)&0xFF]<<16
| av_reverse[(x>>16)&0xFF]<<8 | (uint32_t)av_reverse[(x>>16)&0xFF]<<8
| av_reverse[x>>24]; | (uint32_t)av_reverse[x>>24];
} }
typedef struct { typedef struct {
......
...@@ -58,11 +58,12 @@ static void FUNCC(weight_h264_pixels ## W ## x ## H)(uint8_t *p_block, int strid ...@@ -58,11 +58,12 @@ static void FUNCC(weight_h264_pixels ## W ## x ## H)(uint8_t *p_block, int strid
op_scale1(15); \ op_scale1(15); \
} \ } \
} \ } \
static void FUNCC(biweight_h264_pixels ## W ## x ## H)(uint8_t *p_dst, uint8_t *p_src, int stride, int log2_denom, int weightd, int weights, int offset){ \ static void FUNCC(biweight_h264_pixels ## W ## x ## H)(uint8_t *_dst, uint8_t *_src, int stride, int log2_denom, int weightd, int weights, int offset){ \
int y; \ int y; \
pixel *dst = (pixel*)p_dst; \ pixel *dst = (pixel*)_dst; \
pixel *src = (pixel*)p_src; \ pixel *src = (pixel*)_src; \
stride >>= sizeof(pixel)-1; \ stride >>= sizeof(pixel)-1; \
offset <<= (BIT_DEPTH-8); \
offset = ((offset + 1) | 1) << log2_denom; \ offset = ((offset + 1) | 1) << log2_denom; \
for(y=0; y<H; y++, dst += stride, src += stride){ \ for(y=0; y<H; y++, dst += stride, src += stride){ \
op_scale2(0); \ op_scale2(0); \
......
...@@ -1331,19 +1331,17 @@ static int mpeg_decode_postinit(AVCodecContext *avctx){ ...@@ -1331,19 +1331,17 @@ static int mpeg_decode_postinit(AVCodecContext *avctx){
avctx->ticks_per_frame=2; avctx->ticks_per_frame=2;
//MPEG-2 aspect //MPEG-2 aspect
if(s->aspect_ratio_info > 1){ if(s->aspect_ratio_info > 1){
AVRational dar= AVRational dar =
av_mul_q( av_mul_q(
av_div_q( av_div_q(ff_mpeg2_aspect[s->aspect_ratio_info],
ff_mpeg2_aspect[s->aspect_ratio_info], (AVRational){s1->pan_scan.width, s1->pan_scan.height}),
(AVRational){s1->pan_scan.width, s1->pan_scan.height}
),
(AVRational){s->width, s->height}); (AVRational){s->width, s->height});
//we ignore the spec here and guess a bit as reality does not match the spec, see for example // we ignore the spec here and guess a bit as reality does not match the spec, see for example
// res_change_ffmpeg_aspect.ts and sequence-display-aspect.mpg // res_change_ffmpeg_aspect.ts and sequence-display-aspect.mpg
//issue1613, 621, 562 // issue1613, 621, 562
if( (s1->pan_scan.width == 0 )||(s1->pan_scan.height == 0) if((s1->pan_scan.width == 0 ) || (s1->pan_scan.height == 0) ||
|| (av_cmp_q(dar,(AVRational){4,3})&&av_cmp_q(dar,(AVRational){16,9}))){ (av_cmp_q(dar,(AVRational){4,3}) && av_cmp_q(dar,(AVRational){16,9}))) {
s->avctx->sample_aspect_ratio= s->avctx->sample_aspect_ratio=
av_div_q( av_div_q(
ff_mpeg2_aspect[s->aspect_ratio_info], ff_mpeg2_aspect[s->aspect_ratio_info],
......
...@@ -836,6 +836,13 @@ DEBLOCK_LUMA_INTRA avx ...@@ -836,6 +836,13 @@ DEBLOCK_LUMA_INTRA avx
mova [r0+2*r1], m2 mova [r0+2*r1], m2
%endmacro %endmacro
%macro CHROMA_V_LOAD_TC 2
movd %1, [%2]
punpcklbw %1, %1
punpcklwd %1, %1
psraw %1, 6
%endmacro
%macro DEBLOCK_CHROMA 1 %macro DEBLOCK_CHROMA 1
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; void deblock_v_chroma( uint16_t *pix, int stride, int alpha, int beta, int8_t *tc0 ) ; void deblock_v_chroma( uint16_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
...@@ -854,7 +861,7 @@ cglobal deblock_v_chroma_10_%1, 5,7-(mmsize/16),8*(mmsize/16) ...@@ -854,7 +861,7 @@ cglobal deblock_v_chroma_10_%1, 5,7-(mmsize/16),8*(mmsize/16)
LOAD_AB m4, m5, r2d, r3d LOAD_AB m4, m5, r2d, r3d
LOAD_MASK m0, m1, m2, m3, m4, m5, m7, m6, m4 LOAD_MASK m0, m1, m2, m3, m4, m5, m7, m6, m4
pxor m4, m4 pxor m4, m4
LOAD_TC m6, r4 CHROMA_V_LOAD_TC m6, r4
psubw m6, [pw_3] psubw m6, [pw_3]
pmaxsw m6, m4 pmaxsw m6, m4
pand m7, m6 pand m7, m6
......
...@@ -44,7 +44,7 @@ static int adts_aac_probe(AVProbeData *p) ...@@ -44,7 +44,7 @@ static int adts_aac_probe(AVProbeData *p)
uint32_t header = AV_RB16(buf2); uint32_t header = AV_RB16(buf2);
if((header&0xFFF6) != 0xFFF0) if((header&0xFFF6) != 0xFFF0)
break; break;
fsize = (AV_RB32(buf2+3)>>13) & 0x1FFF; fsize = (AV_RB32(buf2 + 3) >> 13) & 0x1FFF;
if(fsize < 7) if(fsize < 7)
break; break;
buf2 += fsize; buf2 += fsize;
......
...@@ -19,9 +19,6 @@ ...@@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
//#define DEBUG
//#define DEBUG_SEEK
#include <strings.h> #include <strings.h>
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavutil/bswap.h" #include "libavutil/bswap.h"
...@@ -160,10 +157,8 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ ...@@ -160,10 +157,8 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
int64_t last_pos= -1; int64_t last_pos= -1;
int64_t filesize= avio_size(s->pb); int64_t filesize= avio_size(s->pb);
#ifdef DEBUG_SEEK av_dlog(s, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n",
av_log(s, AV_LOG_ERROR, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n",
longs_pre_entry,index_type, entries_in_use, chunk_id, base); longs_pre_entry,index_type, entries_in_use, chunk_id, base);
#endif
if(stream_id >= s->nb_streams || stream_id < 0) if(stream_id >= s->nb_streams || stream_id < 0)
return -1; return -1;
...@@ -1182,10 +1177,8 @@ static int avi_read_idx1(AVFormatContext *s, int size) ...@@ -1182,10 +1177,8 @@ static int avi_read_idx1(AVFormatContext *s, int size)
flags = avio_rl32(pb); flags = avio_rl32(pb);
pos = avio_rl32(pb); pos = avio_rl32(pb);
len = avio_rl32(pb); len = avio_rl32(pb);
#if defined(DEBUG_SEEK) av_dlog(s, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/",
av_log(s, AV_LOG_DEBUG, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/",
i, tag, flags, pos, len); i, tag, flags, pos, len);
#endif
if(i==0 && pos > avi->movi_list) if(i==0 && pos > avi->movi_list)
avi->movi_list= 0; //FIXME better check avi->movi_list= 0; //FIXME better check
pos += avi->movi_list; pos += avi->movi_list;
...@@ -1254,22 +1247,18 @@ static int avi_load_index(AVFormatContext *s) ...@@ -1254,22 +1247,18 @@ static int avi_load_index(AVFormatContext *s)
if (avio_seek(pb, avi->movi_end, SEEK_SET) < 0) if (avio_seek(pb, avi->movi_end, SEEK_SET) < 0)
goto the_end; // maybe truncated file goto the_end; // maybe truncated file
#ifdef DEBUG_SEEK av_dlog(s, "movi_end=0x%"PRIx64"\n", avi->movi_end);
av_log(s, AV_LOG_DEBUG, "movi_end=0x%"PRIx64"\n", avi->movi_end);
#endif
for(;;) { for(;;) {
if (url_feof(pb)) if (url_feof(pb))
break; break;
tag = avio_rl32(pb); tag = avio_rl32(pb);
size = avio_rl32(pb); size = avio_rl32(pb);
#ifdef DEBUG_SEEK av_dlog(s, "tag=%c%c%c%c size=0x%x\n",
av_log(s, AV_LOG_DEBUG, "tag=%c%c%c%c size=0x%x\n",
tag & 0xff, tag & 0xff,
(tag >> 8) & 0xff, (tag >> 8) & 0xff,
(tag >> 16) & 0xff, (tag >> 16) & 0xff,
(tag >> 24) & 0xff, (tag >> 24) & 0xff,
size); size);
#endif
switch(tag) { switch(tag) {
case MKTAG('i', 'd', 'x', '1'): case MKTAG('i', 'd', 'x', '1'):
if (avi_read_idx1(s, size) < 0) if (avi_read_idx1(s, size) < 0)
......
...@@ -163,8 +163,6 @@ static int ffm_read_data(AVFormatContext *s, ...@@ -163,8 +163,6 @@ static int ffm_read_data(AVFormatContext *s,
return size1 - size; return size1 - size;
} }
//#define DEBUG_SEEK
/* ensure that acutal seeking happens between FFM_PACKET_SIZE /* ensure that acutal seeking happens between FFM_PACKET_SIZE
and file_size - FFM_PACKET_SIZE */ and file_size - FFM_PACKET_SIZE */
static void ffm_seek1(AVFormatContext *s, int64_t pos1) static void ffm_seek1(AVFormatContext *s, int64_t pos1)
...@@ -175,9 +173,7 @@ static void ffm_seek1(AVFormatContext *s, int64_t pos1) ...@@ -175,9 +173,7 @@ static void ffm_seek1(AVFormatContext *s, int64_t pos1)
pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE); pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE);
pos = FFMAX(pos, FFM_PACKET_SIZE); pos = FFMAX(pos, FFM_PACKET_SIZE);
#ifdef DEBUG_SEEK av_dlog(s, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos);
av_log(s, AV_LOG_DEBUG, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos);
#endif
avio_seek(pb, pos, SEEK_SET); avio_seek(pb, pos, SEEK_SET);
} }
...@@ -189,9 +185,7 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos) ...@@ -189,9 +185,7 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos)
ffm_seek1(s, pos); ffm_seek1(s, pos);
avio_skip(pb, 4); avio_skip(pb, 4);
dts = avio_rb64(pb); dts = avio_rb64(pb);
#ifdef DEBUG_SEEK av_dlog(s, "dts=%0.6f\n", dts / 1000000.0);
av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0);
#endif
return dts; return dts;
} }
...@@ -464,9 +458,7 @@ static int ffm_seek(AVFormatContext *s, int stream_index, int64_t wanted_pts, in ...@@ -464,9 +458,7 @@ static int ffm_seek(AVFormatContext *s, int stream_index, int64_t wanted_pts, in
int64_t pts_min, pts_max, pts; int64_t pts_min, pts_max, pts;
double pos1; double pos1;
#ifdef DEBUG_SEEK av_dlog(s, "wanted_pts=%0.6f\n", wanted_pts / 1000000.0);
av_log(s, AV_LOG_DEBUG, "wanted_pts=%0.6f\n", wanted_pts / 1000000.0);
#endif
/* find the position using linear interpolation (better than /* find the position using linear interpolation (better than
dichotomy in typical cases) */ dichotomy in typical cases) */
pos_min = FFM_PACKET_SIZE; pos_min = FFM_PACKET_SIZE;
......
...@@ -122,11 +122,12 @@ int ff_url_join(char *str, int size, const char *proto, ...@@ -122,11 +122,12 @@ int ff_url_join(char *str, int size, const char *proto,
* @param dest_type the destination address type, may be NULL * @param dest_type the destination address type, may be NULL
* @param port the destination port of the media stream, 0 if unknown * @param port the destination port of the media stream, 0 if unknown
* @param ttl the time to live of the stream, 0 if not multicast * @param ttl the time to live of the stream, 0 if not multicast
* @param flags the AVFormatContext->flags, modifying the generated SDP * @param fmt the AVFormatContext, which might contain options modifying
* the generated SDP
*/ */
void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, void ff_sdp_write_media(char *buff, int size, AVCodecContext *c,
const char *dest_addr, const char *dest_type, const char *dest_addr, const char *dest_type,
int port, int ttl, int flags); int port, int ttl, AVFormatContext *fmt);
/** /**
* Write a packet to another muxer than the one the user originally * Write a packet to another muxer than the one the user originally
......
...@@ -1537,8 +1537,9 @@ static void mov_build_index(MOVContext *mov, AVStream *st) ...@@ -1537,8 +1537,9 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
/* adjust first dts according to edit list */ /* adjust first dts according to edit list */
if (sc->time_offset && mov->time_scale > 0) { if (sc->time_offset && mov->time_scale > 0) {
int rescaled = sc->time_offset < 0 ? av_rescale(sc->time_offset, sc->time_scale, mov->time_scale) : sc->time_offset; if (sc->time_offset < 0)
current_dts = -rescaled; sc->time_offset = av_rescale(sc->time_offset, sc->time_scale, mov->time_scale);
current_dts = -sc->time_offset;
if (sc->ctts_data && sc->stts_data && if (sc->ctts_data && sc->stts_data &&
sc->ctts_data[0].duration / FFMAX(sc->stts_data[0].duration, 1) > 16) { sc->ctts_data[0].duration / FFMAX(sc->stts_data[0].duration, 1) > 16) {
/* more than 16 frames delay, dts are likely wrong /* more than 16 frames delay, dts are likely wrong
...@@ -2072,7 +2073,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -2072,7 +2073,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (flags & 0x001) data_offset = avio_rb32(pb); if (flags & 0x001) data_offset = avio_rb32(pb);
if (flags & 0x004) first_sample_flags = avio_rb32(pb); if (flags & 0x004) first_sample_flags = avio_rb32(pb);
dts = st->duration; dts = st->duration - sc->time_offset;
offset = frag->base_data_offset + data_offset; offset = frag->base_data_offset + data_offset;
distance = 0; distance = 0;
av_dlog(c->fc, "first sample flags 0x%x\n", first_sample_flags); av_dlog(c->fc, "first sample flags 0x%x\n", first_sample_flags);
...@@ -2101,7 +2102,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -2101,7 +2102,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
offset += sample_size; offset += sample_size;
} }
frag->moof_offset = offset; frag->moof_offset = offset;
st->duration = dts; st->duration = dts + sc->time_offset;
return 0; return 0;
} }
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "libavutil/avstring.h" #include "libavutil/avstring.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
#include "libavutil/dict.h" #include "libavutil/dict.h"
#include "rtpenc.h"
#undef NDEBUG #undef NDEBUG
#include <assert.h> #include <assert.h>
...@@ -41,6 +42,7 @@ ...@@ -41,6 +42,7 @@
static const AVOption options[] = { static const AVOption options[] = {
{ "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags), FF_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, { "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags), FF_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
{ "rtphint", "Add RTP hint tracks", 0, FF_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_RTP_HINT}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, { "rtphint", "Add RTP hint tracks", 0, FF_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_RTP_HINT}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags),
{ NULL }, { NULL },
}; };
...@@ -1368,7 +1370,7 @@ static int mov_write_udta_sdp(AVIOContext *pb, AVFormatContext *ctx, int index) ...@@ -1368,7 +1370,7 @@ static int mov_write_udta_sdp(AVIOContext *pb, AVFormatContext *ctx, int index)
char buf[1000] = ""; char buf[1000] = "";
int len; int len;
ff_sdp_write_media(buf, sizeof(buf), ctx->streams[0]->codec, NULL, NULL, 0, 0, ctx->flags); ff_sdp_write_media(buf, sizeof(buf), ctx->streams[0]->codec, NULL, NULL, 0, 0, ctx);
av_strlcatf(buf, sizeof(buf), "a=control:streamid=%d\r\n", index); av_strlcatf(buf, sizeof(buf), "a=control:streamid=%d\r\n", index);
len = strlen(buf); len = strlen(buf);
......
...@@ -111,6 +111,7 @@ typedef struct MOVMuxContext { ...@@ -111,6 +111,7 @@ typedef struct MOVMuxContext {
MOVTrack *tracks; MOVTrack *tracks;
int flags; int flags;
int rtp_flags;
} MOVMuxContext; } MOVMuxContext;
#define FF_MOV_FLAG_RTP_HINT 1 #define FF_MOV_FLAG_RTP_HINT 1
......
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
#include "internal.h" #include "internal.h"
#include "mpeg.h" #include "mpeg.h"
//#define DEBUG_SEEK
#undef NDEBUG #undef NDEBUG
#include <assert.h> #include <assert.h>
...@@ -592,9 +590,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index, ...@@ -592,9 +590,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
for(;;) { for(;;) {
len = mpegps_read_pes_header(s, &pos, &startcode, &pts, &dts); len = mpegps_read_pes_header(s, &pos, &startcode, &pts, &dts);
if (len < 0) { if (len < 0) {
#ifdef DEBUG_SEEK av_dlog(s, "none (ret=%d)\n", len);
av_log(s, AV_LOG_DEBUG, "none (ret=%d)\n", len);
#endif
return AV_NOPTS_VALUE; return AV_NOPTS_VALUE;
} }
if (startcode == s->streams[stream_index]->id && if (startcode == s->streams[stream_index]->id &&
...@@ -603,10 +599,8 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index, ...@@ -603,10 +599,8 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
} }
avio_skip(s->pb, len); avio_skip(s->pb, len);
} }
#ifdef DEBUG_SEEK av_dlog(s, "pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n",
av_log(s, AV_LOG_DEBUG, "pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n",
pos, dts, dts / 90000.0); pos, dts, dts / 90000.0);
#endif
*ppos = pos; *ppos = pos;
return dts; return dts;
} }
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "mpeg.h" #include "mpeg.h"
#define MAX_PAYLOAD_SIZE 4096 #define MAX_PAYLOAD_SIZE 4096
//#define DEBUG_SEEK
#undef NDEBUG #undef NDEBUG
#include <assert.h> #include <assert.h>
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
//#define DEBUG
//#define DEBUG_SEEK
//#define USE_SYNCPOINT_SEARCH //#define USE_SYNCPOINT_SEARCH
#include "libavutil/crc.h" #include "libavutil/crc.h"
......
...@@ -22,9 +22,7 @@ ...@@ -22,9 +22,7 @@
#include "riff.h" #include "riff.h"
#include "libavutil/dict.h" #include "libavutil/dict.h"
//#define DEBUG
//#define DEBUG_DUMP_INDEX // XXX dumbdriving-271.nsv breaks with it commented!! //#define DEBUG_DUMP_INDEX // XXX dumbdriving-271.nsv breaks with it commented!!
//#define DEBUG_SEEK
#define CHECK_SUBSEQUENT_NSVS #define CHECK_SUBSEQUENT_NSVS
//#define DISABLE_AUDIO //#define DISABLE_AUDIO
......
...@@ -23,11 +23,24 @@ ...@@ -23,11 +23,24 @@
#include "mpegts.h" #include "mpegts.h"
#include "internal.h" #include "internal.h"
#include "libavutil/random_seed.h" #include "libavutil/random_seed.h"
#include "libavutil/opt.h"
#include "rtpenc.h" #include "rtpenc.h"
//#define DEBUG //#define DEBUG
static const AVOption options[] = {
FF_RTP_FLAG_OPTS(RTPMuxContext, flags),
{ NULL },
};
static const AVClass rtp_muxer_class = {
.class_name = "RTP muxer",
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
};
#define RTCP_SR_SIZE 28 #define RTCP_SR_SIZE 28
static int is_supported(enum CodecID id) static int is_supported(enum CodecID id)
...@@ -404,7 +417,7 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt) ...@@ -404,7 +417,7 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
ff_rtp_send_mpegvideo(s1, pkt->data, size); ff_rtp_send_mpegvideo(s1, pkt->data, size);
break; break;
case CODEC_ID_AAC: case CODEC_ID_AAC:
if (s1->flags & AVFMT_FLAG_MP4A_LATM) if (s->flags & FF_RTP_FLAG_MP4A_LATM)
ff_rtp_send_latm(s1, pkt->data, size); ff_rtp_send_latm(s1, pkt->data, size);
else else
ff_rtp_send_aac(s1, pkt->data, size); ff_rtp_send_aac(s1, pkt->data, size);
...@@ -458,4 +471,5 @@ AVOutputFormat ff_rtp_muxer = { ...@@ -458,4 +471,5 @@ AVOutputFormat ff_rtp_muxer = {
rtp_write_header, rtp_write_header,
rtp_write_packet, rtp_write_packet,
rtp_write_trailer, rtp_write_trailer,
.priv_class = &rtp_muxer_class,
}; };
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "rtp.h" #include "rtp.h"
struct RTPMuxContext { struct RTPMuxContext {
const AVClass *av_class;
AVFormatContext *ic; AVFormatContext *ic;
AVStream *st; AVStream *st;
int payload_type; int payload_type;
...@@ -56,10 +57,18 @@ struct RTPMuxContext { ...@@ -56,10 +57,18 @@ struct RTPMuxContext {
* (1, 2 or 4) * (1, 2 or 4)
*/ */
int nal_length_size; int nal_length_size;
int flags;
}; };
typedef struct RTPMuxContext RTPMuxContext; typedef struct RTPMuxContext RTPMuxContext;
#define FF_RTP_FLAG_MP4A_LATM 1
#define FF_RTP_FLAG_OPTS(ctx, fieldname) \
{ "rtpflags", "RTP muxer flags", offsetof(ctx, fieldname), FF_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
{ "latm", "Use MP4A-LATM packetization instead of MPEG4-GENERIC for AAC", 0, FF_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_MP4A_LATM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" } \
void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m); void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m);
void ff_rtp_send_h264(AVFormatContext *s1, const uint8_t *buf1, int size); void ff_rtp_send_h264(AVFormatContext *s1, const uint8_t *buf1, int size);
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "avio_internal.h" #include "avio_internal.h"
#include "rtpenc_chain.h" #include "rtpenc_chain.h"
#include "avio_internal.h" #include "avio_internal.h"
#include "libavutil/opt.h"
AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
URLContext *handle, int packet_size) URLContext *handle, int packet_size)
...@@ -50,6 +51,13 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, ...@@ -50,6 +51,13 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
rtpctx->streams[0]->sample_aspect_ratio = st->sample_aspect_ratio; rtpctx->streams[0]->sample_aspect_ratio = st->sample_aspect_ratio;
rtpctx->flags |= s->flags & AVFMT_FLAG_MP4A_LATM; rtpctx->flags |= s->flags & AVFMT_FLAG_MP4A_LATM;
av_set_parameters(rtpctx, NULL);
/* Copy the rtpflags values straight through */
if (s->oformat->priv_class &&
av_find_opt(s->priv_data, "rtpflags", NULL, 0, 0))
av_set_int(rtpctx->priv_data, "rtpflags",
av_get_int(s->priv_data, "rtpflags", NULL));
/* Set the synchronized start time. */ /* Set the synchronized start time. */
rtpctx->start_time_realtime = s->start_time_realtime; rtpctx->start_time_realtime = s->start_time_realtime;
......
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
#include "avformat.h" #include "avformat.h"
#include "rtpenc.h" #include "rtpenc.h"
void ff_rtp_send_latm(AVFormatContext *s1, const uint8_t *buff, int size) { void ff_rtp_send_latm(AVFormatContext *s1, const uint8_t *buff, int size)
{
/* MP4A-LATM /* MP4A-LATM
* The RTP payload format specification is described in RFC 3016 * The RTP payload format specification is described in RFC 3016
* The encoding specifications are provided in ISO/IEC 14496-3 */ * The encoding specifications are provided in ISO/IEC 14496-3 */
......
...@@ -344,6 +344,11 @@ typedef struct RTSPState { ...@@ -344,6 +344,11 @@ typedef struct RTSPState {
* Do not begin to play the stream immediately. * Do not begin to play the stream immediately.
*/ */
int initial_pause; int initial_pause;
/**
* Option flags for the chained RTP muxer.
*/
int rtp_muxer_flags;
} RTSPState; } RTSPState;
/** /**
......
...@@ -33,9 +33,23 @@ ...@@ -33,9 +33,23 @@
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavutil/avstring.h" #include "libavutil/avstring.h"
#include "url.h" #include "url.h"
#include "libavutil/opt.h"
#include "rtpenc.h"
#define SDP_MAX_SIZE 16384 #define SDP_MAX_SIZE 16384
static const AVOption options[] = {
FF_RTP_FLAG_OPTS(RTSPState, rtp_muxer_flags),
{ NULL },
};
static const AVClass rtsp_muxer_class = {
.class_name = "RTSP muxer",
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
};
int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr) int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr)
{ {
RTSPState *rt = s->priv_data; RTSPState *rt = s->priv_data;
...@@ -238,5 +252,6 @@ AVOutputFormat ff_rtsp_muxer = { ...@@ -238,5 +252,6 @@ AVOutputFormat ff_rtsp_muxer = {
rtsp_write_packet, rtsp_write_packet,
rtsp_write_close, rtsp_write_close,
.flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER, .flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER,
.priv_class = &rtsp_muxer_class,
}; };
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "libavutil/base64.h" #include "libavutil/base64.h"
#include "libavutil/dict.h" #include "libavutil/dict.h"
#include "libavutil/parseutils.h" #include "libavutil/parseutils.h"
#include "libavutil/opt.h"
#include "libavcodec/xiph.h" #include "libavcodec/xiph.h"
#include "libavcodec/mpeg4audio.h" #include "libavcodec/mpeg4audio.h"
#include "avformat.h" #include "avformat.h"
...@@ -301,7 +302,8 @@ xiph_fail: ...@@ -301,7 +302,8 @@ xiph_fail:
return NULL; return NULL;
} }
static int latm_context2profilelevel(AVCodecContext *c) { static int latm_context2profilelevel(AVCodecContext *c)
{
/* MP4A-LATM /* MP4A-LATM
* The RTP payload format specification is described in RFC 3016 * The RTP payload format specification is described in RFC 3016
* The encoding specifications are provided in ISO/IEC 14496-3 */ * The encoding specifications are provided in ISO/IEC 14496-3 */
...@@ -329,7 +331,8 @@ static int latm_context2profilelevel(AVCodecContext *c) { ...@@ -329,7 +331,8 @@ static int latm_context2profilelevel(AVCodecContext *c) {
return profile_level; return profile_level;
} }
static char *latm_context2config(AVCodecContext *c) { static char *latm_context2config(AVCodecContext *c)
{
/* MP4A-LATM /* MP4A-LATM
* The RTP payload format specification is described in RFC 3016 * The RTP payload format specification is described in RFC 3016
* The encoding specifications are provided in ISO/IEC 14496-3 */ * The encoding specifications are provided in ISO/IEC 14496-3 */
...@@ -364,7 +367,7 @@ static char *latm_context2config(AVCodecContext *c) { ...@@ -364,7 +367,7 @@ static char *latm_context2config(AVCodecContext *c) {
return config; return config;
} }
static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, int payload_type, int flags) static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, int payload_type, AVFormatContext *fmt)
{ {
char *config = NULL; char *config = NULL;
...@@ -399,7 +402,8 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, ...@@ -399,7 +402,8 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
payload_type, config ? config : ""); payload_type, config ? config : "");
break; break;
case CODEC_ID_AAC: case CODEC_ID_AAC:
if (flags & AVFMT_FLAG_MP4A_LATM) { if (fmt && fmt->oformat->priv_class &&
av_opt_flag_is_set(fmt->priv_data, "rtpflags", "latm")) {
config = latm_context2config(c); config = latm_context2config(c);
if (!config) if (!config)
return NULL; return NULL;
...@@ -523,7 +527,7 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, ...@@ -523,7 +527,7 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
return buff; return buff;
} }
void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, int flags) void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, AVFormatContext *fmt)
{ {
const char *type; const char *type;
int payload_type; int payload_type;
...@@ -546,7 +550,7 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des ...@@ -546,7 +550,7 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des
av_strlcatf(buff, size, "b=AS:%d\r\n", c->bit_rate / 1000); av_strlcatf(buff, size, "b=AS:%d\r\n", c->bit_rate / 1000);
} }
sdp_write_media_attributes(buff, size, c, payload_type, flags); sdp_write_media_attributes(buff, size, c, payload_type, fmt);
} }
int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size) int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
...@@ -596,7 +600,7 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size) ...@@ -596,7 +600,7 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
ff_sdp_write_media(buf, size, ff_sdp_write_media(buf, size,
ac[i]->streams[j]->codec, dst[0] ? dst : NULL, ac[i]->streams[j]->codec, dst[0] ? dst : NULL,
dst_type, (port > 0) ? port + j * 2 : 0, ttl, dst_type, (port > 0) ? port + j * 2 : 0, ttl,
ac[i]->flags); ac[i]);
if (port <= 0) { if (port <= 0) {
av_strlcatf(buf, size, av_strlcatf(buf, size,
"a=control:streamid=%d\r\n", i + j); "a=control:streamid=%d\r\n", i + j);
...@@ -612,7 +616,7 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size) ...@@ -612,7 +616,7 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
return AVERROR(ENOSYS); return AVERROR(ENOSYS);
} }
void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, int flags) void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, AVFormatContext *fmt)
{ {
} }
#endif #endif
......
...@@ -1449,8 +1449,6 @@ int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp, ...@@ -1449,8 +1449,6 @@ int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp,
wanted_timestamp, flags); wanted_timestamp, flags);
} }
#define DEBUG_SEEK
int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags){ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags){
AVInputFormat *avif= s->iformat; AVInputFormat *avif= s->iformat;
int64_t av_uninit(pos_min), av_uninit(pos_max), pos, pos_limit; int64_t av_uninit(pos_min), av_uninit(pos_max), pos, pos_limit;
...@@ -1462,9 +1460,7 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts ...@@ -1462,9 +1460,7 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts
if (stream_index < 0) if (stream_index < 0)
return -1; return -1;
#ifdef DEBUG_SEEK av_dlog(s, "read_seek: %d %"PRId64"\n", stream_index, target_ts);
av_log(s, AV_LOG_DEBUG, "read_seek: %d %"PRId64"\n", stream_index, target_ts);
#endif
ts_max= ts_max=
ts_min= AV_NOPTS_VALUE; ts_min= AV_NOPTS_VALUE;
...@@ -1481,10 +1477,8 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts ...@@ -1481,10 +1477,8 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts
if(e->timestamp <= target_ts || e->pos == e->min_distance){ if(e->timestamp <= target_ts || e->pos == e->min_distance){
pos_min= e->pos; pos_min= e->pos;
ts_min= e->timestamp; ts_min= e->timestamp;
#ifdef DEBUG_SEEK av_dlog(s, "using cached pos_min=0x%"PRIx64" dts_min=%"PRId64"\n",
av_log(s, AV_LOG_DEBUG, "using cached pos_min=0x%"PRIx64" dts_min=%"PRId64"\n",
pos_min,ts_min); pos_min,ts_min);
#endif
}else{ }else{
assert(index==0); assert(index==0);
} }
...@@ -1497,10 +1491,8 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts ...@@ -1497,10 +1491,8 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts
pos_max= e->pos; pos_max= e->pos;
ts_max= e->timestamp; ts_max= e->timestamp;
pos_limit= pos_max - e->min_distance; pos_limit= pos_max - e->min_distance;
#ifdef DEBUG_SEEK av_dlog(s, "using cached pos_max=0x%"PRIx64" pos_limit=0x%"PRIx64" dts_max=%"PRId64"\n",
av_log(s, AV_LOG_DEBUG, "using cached pos_max=0x%"PRIx64" pos_limit=0x%"PRIx64" dts_max=%"PRId64"\n",
pos_max,pos_limit, ts_max); pos_max,pos_limit, ts_max);
#endif
} }
} }
...@@ -1522,9 +1514,7 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i ...@@ -1522,9 +1514,7 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
int64_t start_pos, filesize; int64_t start_pos, filesize;
int no_change; int no_change;
#ifdef DEBUG_SEEK av_dlog(s, "gen_seek: %d %"PRId64"\n", stream_index, target_ts);
av_log(s, AV_LOG_DEBUG, "gen_seek: %d %"PRId64"\n", stream_index, target_ts);
#endif
if(ts_min == AV_NOPTS_VALUE){ if(ts_min == AV_NOPTS_VALUE){
pos_min = s->data_offset; pos_min = s->data_offset;
...@@ -1566,11 +1556,8 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i ...@@ -1566,11 +1556,8 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
no_change=0; no_change=0;
while (pos_min < pos_limit) { while (pos_min < pos_limit) {
#ifdef DEBUG_SEEK av_dlog(s, "pos_min=0x%"PRIx64" pos_max=0x%"PRIx64" dts_min=%"PRId64" dts_max=%"PRId64"\n",
av_log(s, AV_LOG_DEBUG, "pos_min=0x%"PRIx64" pos_max=0x%"PRIx64" dts_min=%"PRId64" dts_max=%"PRId64"\n", pos_min, pos_max, ts_min, ts_max);
pos_min, pos_max,
ts_min, ts_max);
#endif
assert(pos_limit <= pos_max); assert(pos_limit <= pos_max);
if(no_change==0){ if(no_change==0){
...@@ -1597,11 +1584,9 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i ...@@ -1597,11 +1584,9 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
no_change++; no_change++;
else else
no_change=0; no_change=0;
#ifdef DEBUG_SEEK av_dlog(s, "%"PRId64" %"PRId64" %"PRId64" / %"PRId64" %"PRId64" %"PRId64" target:%"PRId64" limit:%"PRId64" start:%"PRId64" noc:%d\n",
av_log(s, AV_LOG_DEBUG, "%"PRId64" %"PRId64" %"PRId64" / %"PRId64" %"PRId64" %"PRId64" target:%"PRId64" limit:%"PRId64" start:%"PRId64" noc:%d\n", pos_min, pos, pos_max, ts_min, ts, ts_max, target_ts,
pos_min, pos, pos_max, ts_min, ts, ts_max, target_ts, pos_limit, pos_limit, start_pos, no_change);
start_pos, no_change);
#endif
if(ts == AV_NOPTS_VALUE){ if(ts == AV_NOPTS_VALUE){
av_log(s, AV_LOG_ERROR, "read_timestamp() failed in the middle\n"); av_log(s, AV_LOG_ERROR, "read_timestamp() failed in the middle\n");
return -1; return -1;
...@@ -1620,12 +1605,12 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i ...@@ -1620,12 +1605,12 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max; pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max;
ts = (flags & AVSEEK_FLAG_BACKWARD) ? ts_min : ts_max; ts = (flags & AVSEEK_FLAG_BACKWARD) ? ts_min : ts_max;
#ifdef DEBUG_SEEK #if 1
pos_min = pos; pos_min = pos;
ts_min = read_timestamp(s, stream_index, &pos_min, INT64_MAX); ts_min = read_timestamp(s, stream_index, &pos_min, INT64_MAX);
pos_min++; pos_min++;
ts_max = read_timestamp(s, stream_index, &pos_min, INT64_MAX); ts_max = read_timestamp(s, stream_index, &pos_min, INT64_MAX);
av_log(s, AV_LOG_DEBUG, "pos=0x%"PRIx64" %"PRId64"<=%"PRId64"<=%"PRId64"\n", av_dlog(s, "pos=0x%"PRIx64" %"PRId64"<=%"PRId64"<=%"PRId64"\n",
pos, ts_min, target_ts, ts_max); pos, ts_min, target_ts, ts_max);
#endif #endif
*ts_ret= ts; *ts_ret= ts;
...@@ -2694,9 +2679,7 @@ AVProgram *av_new_program(AVFormatContext *ac, int id) ...@@ -2694,9 +2679,7 @@ AVProgram *av_new_program(AVFormatContext *ac, int id)
AVProgram *program=NULL; AVProgram *program=NULL;
int i; int i;
#ifdef DEBUG_SI av_dlog(ac, "new_program: id=0x%04x\n", id);
av_log(ac, AV_LOG_DEBUG, "new_program: id=0x%04x\n", id);
#endif
for(i=0; i<ac->nb_programs; i++) for(i=0; i<ac->nb_programs; i++)
if(ac->programs[i]->id == id) if(ac->programs[i]->id == id)
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 53 #define LIBAVFORMAT_VERSION_MAJOR 53
#define LIBAVFORMAT_VERSION_MINOR 3 #define LIBAVFORMAT_VERSION_MINOR 3
#define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_MICRO 1
#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, \
......
...@@ -320,6 +320,16 @@ int64_t av_get_int(void *obj, const char *name, const AVOption **o_out) ...@@ -320,6 +320,16 @@ int64_t av_get_int(void *obj, const char *name, const AVOption **o_out)
return num*intnum/den; return num*intnum/den;
} }
int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name)
{
const AVOption *field = av_find_opt(obj, field_name, NULL, 0, 0);
const AVOption *flag = av_find_opt(obj, flag_name, NULL, 0, 0);
if (!field || !flag || flag->type != FF_OPT_TYPE_CONST)
return 0;
return av_get_int(obj, field_name, NULL) & (int) flag->default_val.dbl;
}
static void opt_list(void *obj, void *av_log_obj, const char *unit, static void opt_list(void *obj, void *av_log_obj, const char *unit,
int req_flags, int rej_flags) int req_flags, int rej_flags)
{ {
......
...@@ -181,4 +181,14 @@ int av_set_options_string(void *ctx, const char *opts, ...@@ -181,4 +181,14 @@ int av_set_options_string(void *ctx, const char *opts,
*/ */
void av_opt_free(void *obj); void av_opt_free(void *obj);
/**
* Check whether a particular flag is set in a flags field.
*
* @param field_name the name of the flag field option
* @param flag_name the name of the flag to check
* @return non-zero if the flag is set, zero if the flag isn't set,
* isn't of the right type, or the flags field doesn't exist.
*/
int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name);
#endif /* AVUTIL_OPT_H */ #endif /* AVUTIL_OPT_H */
...@@ -878,6 +878,52 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { ...@@ -878,6 +878,52 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
}, },
.flags = PIX_FMT_BE, .flags = PIX_FMT_BE,
}, },
[PIX_FMT_YUV444P10LE] = {
.name = "yuv444p10le",
.nb_components= 3,
.log2_chroma_w= 0,
.log2_chroma_h= 0,
.comp = {
{0,1,1,0,9}, /* Y */
{1,1,1,0,9}, /* U */
{2,1,1,0,9}, /* V */
},
},
[PIX_FMT_YUV444P10BE] = {
.name = "yuv444p10be",
.nb_components= 3,
.log2_chroma_w= 0,
.log2_chroma_h= 0,
.comp = {
{0,1,1,0,9}, /* Y */
{1,1,1,0,9}, /* U */
{2,1,1,0,9}, /* V */
},
.flags = PIX_FMT_BE,
},
[PIX_FMT_YUV444P9LE] = {
.name = "yuv444p9le",
.nb_components= 3,
.log2_chroma_w= 0,
.log2_chroma_h= 0,
.comp = {
{0,1,1,0,8}, /* Y */
{1,1,1,0,8}, /* U */
{2,1,1,0,8}, /* V */
},
},
[PIX_FMT_YUV444P9BE] = {
.name = "yuv444p9be",
.nb_components= 3,
.log2_chroma_w= 0,
.log2_chroma_h= 0,
.comp = {
{0,1,1,0,9}, /* Y */
{1,1,1,0,9}, /* U */
{2,1,1,0,9}, /* V */
},
.flags = PIX_FMT_BE,
},
[PIX_FMT_DXVA2_VLD] = { [PIX_FMT_DXVA2_VLD] = {
.name = "dxva2_vld", .name = "dxva2_vld",
.log2_chroma_w = 1, .log2_chroma_w = 1,
......
...@@ -136,15 +136,19 @@ enum PixelFormat { ...@@ -136,15 +136,19 @@ enum PixelFormat {
PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian
PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian
//the following 6 formats have the disadvantage of needing 1 format for each bit depth, thus //the following 10 formats have the disadvantage of needing 1 format for each bit depth, thus
//If you want to support multiple bit depths, then using PIX_FMT_YUV420P16* with the bpp stored seperately //If you want to support multiple bit depths, then using PIX_FMT_YUV420P16* with the bpp stored seperately
//is better //is better
PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
}; };
...@@ -173,8 +177,10 @@ enum PixelFormat { ...@@ -173,8 +177,10 @@ enum PixelFormat {
#define PIX_FMT_BGR444 PIX_FMT_NE(BGR444BE, BGR444LE) #define PIX_FMT_BGR444 PIX_FMT_NE(BGR444BE, BGR444LE)
#define PIX_FMT_YUV420P9 PIX_FMT_NE(YUV420P9BE , YUV420P9LE) #define PIX_FMT_YUV420P9 PIX_FMT_NE(YUV420P9BE , YUV420P9LE)
#define PIX_FMT_YUV444P9 PIX_FMT_NE(YUV444P9BE , YUV444P9LE)
#define PIX_FMT_YUV420P10 PIX_FMT_NE(YUV420P10BE, YUV420P10LE) #define PIX_FMT_YUV420P10 PIX_FMT_NE(YUV420P10BE, YUV420P10LE)
#define PIX_FMT_YUV422P10 PIX_FMT_NE(YUV422P10BE, YUV422P10LE) #define PIX_FMT_YUV422P10 PIX_FMT_NE(YUV422P10BE, YUV422P10LE)
#define PIX_FMT_YUV444P10 PIX_FMT_NE(YUV444P10BE, YUV444P10LE)
#define PIX_FMT_YUV420P16 PIX_FMT_NE(YUV420P16BE, YUV420P16LE) #define PIX_FMT_YUV420P16 PIX_FMT_NE(YUV420P16BE, YUV420P16LE)
#define PIX_FMT_YUV422P16 PIX_FMT_NE(YUV422P16BE, YUV422P16LE) #define PIX_FMT_YUV422P16 PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
#define PIX_FMT_YUV444P16 PIX_FMT_NE(YUV444P16BE, YUV444P16LE) #define PIX_FMT_YUV444P16 PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
......
This diff is collapsed.
...@@ -371,6 +371,12 @@ const char *sws_format_name(enum PixelFormat format); ...@@ -371,6 +371,12 @@ const char *sws_format_name(enum PixelFormat format);
#define isNBPS(x) ( \ #define isNBPS(x) ( \
(x)==PIX_FMT_YUV420P9LE \ (x)==PIX_FMT_YUV420P9LE \
|| (x)==PIX_FMT_YUV420P9BE \ || (x)==PIX_FMT_YUV420P9BE \
|| (x)==PIX_FMT_YUV444P9BE \
|| (x)==PIX_FMT_YUV444P9LE \
|| (x)==PIX_FMT_YUV422P10BE \
|| (x)==PIX_FMT_YUV422P10LE \
|| (x)==PIX_FMT_YUV444P10BE \
|| (x)==PIX_FMT_YUV444P10LE \
|| (x)==PIX_FMT_YUV420P10LE \ || (x)==PIX_FMT_YUV420P10LE \
|| (x)==PIX_FMT_YUV420P10BE \ || (x)==PIX_FMT_YUV420P10BE \
|| (x)==PIX_FMT_YUV422P10LE \ || (x)==PIX_FMT_YUV422P10LE \
...@@ -392,13 +398,19 @@ const char *sws_format_name(enum PixelFormat format); ...@@ -392,13 +398,19 @@ const char *sws_format_name(enum PixelFormat format);
#define isPlanarYUV(x) ( \ #define isPlanarYUV(x) ( \
isPlanar8YUV(x) \ isPlanar8YUV(x) \
|| (x)==PIX_FMT_YUV420P9LE \ || (x)==PIX_FMT_YUV420P9LE \
|| (x)==PIX_FMT_YUV444P9LE \
|| (x)==PIX_FMT_YUV420P10LE \ || (x)==PIX_FMT_YUV420P10LE \
|| (x)==PIX_FMT_YUV422P10LE \
|| (x)==PIX_FMT_YUV444P10LE \
|| (x)==PIX_FMT_YUV420P16LE \ || (x)==PIX_FMT_YUV420P16LE \
|| (x)==PIX_FMT_YUV422P10LE \ || (x)==PIX_FMT_YUV422P10LE \
|| (x)==PIX_FMT_YUV422P16LE \ || (x)==PIX_FMT_YUV422P16LE \
|| (x)==PIX_FMT_YUV444P16LE \ || (x)==PIX_FMT_YUV444P16LE \
|| (x)==PIX_FMT_YUV420P9BE \ || (x)==PIX_FMT_YUV420P9BE \
|| (x)==PIX_FMT_YUV444P9BE \
|| (x)==PIX_FMT_YUV420P10BE \ || (x)==PIX_FMT_YUV420P10BE \
|| (x)==PIX_FMT_YUV422P10BE \
|| (x)==PIX_FMT_YUV444P10BE \
|| (x)==PIX_FMT_YUV420P16BE \ || (x)==PIX_FMT_YUV420P16BE \
|| (x)==PIX_FMT_YUV422P10BE \ || (x)==PIX_FMT_YUV422P10BE \
|| (x)==PIX_FMT_YUV422P16BE \ || (x)==PIX_FMT_YUV422P16BE \
......
...@@ -112,12 +112,18 @@ const char *swscale_license(void) ...@@ -112,12 +112,18 @@ const char *swscale_license(void)
|| (x)==PIX_FMT_MONOWHITE \ || (x)==PIX_FMT_MONOWHITE \
|| (x)==PIX_FMT_MONOBLACK \ || (x)==PIX_FMT_MONOBLACK \
|| (x)==PIX_FMT_YUV420P9LE \ || (x)==PIX_FMT_YUV420P9LE \
|| (x)==PIX_FMT_YUV444P9LE \
|| (x)==PIX_FMT_YUV420P10LE \ || (x)==PIX_FMT_YUV420P10LE \
|| (x)==PIX_FMT_YUV422P10LE \
|| (x)==PIX_FMT_YUV444P10LE \
|| (x)==PIX_FMT_YUV420P16LE \ || (x)==PIX_FMT_YUV420P16LE \
|| (x)==PIX_FMT_YUV422P16LE \ || (x)==PIX_FMT_YUV422P16LE \
|| (x)==PIX_FMT_YUV444P16LE \ || (x)==PIX_FMT_YUV444P16LE \
|| (x)==PIX_FMT_YUV420P9BE \ || (x)==PIX_FMT_YUV420P9BE \
|| (x)==PIX_FMT_YUV444P9BE \
|| (x)==PIX_FMT_YUV420P10BE \ || (x)==PIX_FMT_YUV420P10BE \
|| (x)==PIX_FMT_YUV444P10BE \
|| (x)==PIX_FMT_YUV422P10BE \
|| (x)==PIX_FMT_YUV420P16BE \ || (x)==PIX_FMT_YUV420P16BE \
|| (x)==PIX_FMT_YUV422P16BE \ || (x)==PIX_FMT_YUV422P16BE \
|| (x)==PIX_FMT_YUV444P16BE \ || (x)==PIX_FMT_YUV444P16BE \
......
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