Permalink
Browse files

Roll-up of all changes after the previous sync

  • Loading branch information...
1 parent 9cb02de commit 940dd94d1ac092f61d9eebab542c96b7b54b7d45 @Beirdo Beirdo committed Apr 1, 2012
View
2 mythtv/external/FFmpeg/Makefile
@@ -108,7 +108,7 @@ GIT_LOG = $(SRC_PATH_BARE)/.git/logs/HEAD
.version: M=@
version.h .version:
- $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
+ $(M)$(VERSION_SH) $(SRC_PATH)/external/FFmpeg version.h $(EXTRA_VERSION)
$(Q)touch .version
# force version.sh to run whenever version might have changed
View
7 mythtv/external/FFmpeg/libavcodec/aacdec.c
@@ -716,6 +716,10 @@ static int decode_audio_specific_config(AACContext *ac,
m4ac->object_type, m4ac->chan_config, m4ac->sampling_index,
m4ac->sample_rate, m4ac->sbr, m4ac->ps);
+ av_dlog(avctx, "AOT %d chan config %d sampling index %d (%d) SBR %d PS %d\n",
+ m4ac->object_type, m4ac->chan_config, m4ac->sampling_index,
+ m4ac->sample_rate, m4ac->sbr, m4ac->ps);
+
return get_bits_count(&gb);
}
@@ -2593,6 +2597,8 @@ static int latm_decode_audio_specific_config(struct LATMContext *latmctx,
av_log(avctx, AV_LOG_INFO, "audio config changed\n");
latmctx->initialized = 0;
+ ac->m4ac= m4ac;
+
esize = (bits_consumed+7) / 8;
if (avctx->extradata_size < esize) {
@@ -2769,6 +2775,7 @@ static int latm_decode_frame(AVCodecContext *avctx, void *out,
*got_frame_ptr = 0;
return avpkt->size;
} else {
+ aac_decode_close(avctx);
if ((err = decode_audio_specific_config(
&latmctx->aac_ctx, avctx, &latmctx->aac_ctx.m4ac,
avctx->extradata, avctx->extradata_size*8, 1)) < 0)
View
8 mythtv/external/FFmpeg/libavcodec/avcodec.h
@@ -1240,6 +1240,13 @@ typedef struct AVFrame {
uint8_t atsc_cc_buf[1024];\
int atsc_cc_len;
+ /** SCTE CC data CEA-608
+ * - encoding: unused
+ * - decoding: Set by libavcodec
+ */
+ uint8_t scte_cc_buf[1024];
+ int scte_cc_len;
+
} AVFrame;
struct AVCodecInternal;
@@ -3135,6 +3142,7 @@ typedef struct AVSubtitle {
unsigned num_rects;
AVSubtitleRect **rects;
int64_t pts; ///< Same as packet pts, in AV_TIME_BASE
+ int forced;
} AVSubtitle;
/* packet functions */
View
11 mythtv/external/FFmpeg/libavcodec/dvbsubdec.c
@@ -1497,6 +1497,7 @@ static int dvbsub_decode(AVCodecContext *avctx,
p = buf;
p_end = buf + buf_size;
+ int gotpage, gotregion, gotclut, gotobject, gotdisplay = 0;
while (p_end - p >= 6 && *p == 0x0f) {
p += 1;
segment_type = *p++;
@@ -1516,25 +1517,30 @@ static int dvbsub_decode(AVCodecContext *avctx,
case DVBSUB_PAGE_SEGMENT:
dvbsub_parse_page_segment(avctx, p, segment_length);
got_segment |= 1;
+ gotpage = 1;
break;
case DVBSUB_REGION_SEGMENT:
dvbsub_parse_region_segment(avctx, p, segment_length);
got_segment |= 2;
+ gotregion = 1;
break;
case DVBSUB_CLUT_SEGMENT:
dvbsub_parse_clut_segment(avctx, p, segment_length);
got_segment |= 4;
+ gotclut = 1;
break;
case DVBSUB_OBJECT_SEGMENT:
dvbsub_parse_object_segment(avctx, p, segment_length);
got_segment |= 8;
+ gotobject = 1;
break;
case DVBSUB_DISPLAYDEFINITION_SEGMENT:
dvbsub_parse_display_definition_segment(avctx, p, segment_length);
break;
case DVBSUB_DISPLAY_SEGMENT:
*data_size = dvbsub_display_end_segment(avctx, p, segment_length, sub);
got_segment |= 16;
+ gotdisplay = 1;
break;
default:
av_dlog(avctx, "Subtitling segment type 0x%x, page id %d, length %d\n",
@@ -1550,6 +1556,11 @@ static int dvbsub_decode(AVCodecContext *avctx,
if (got_segment == 15 && sub)
*data_size = dvbsub_display_end_segment(avctx, p, 0, sub);
+ // Some streams do not send a display segment but if we have all the other
+ // segments then we need no further data. see #9373
+ if ((gotpage & gotregion & gotclut & gotobject) && !gotdisplay && sub)
+ *data_size = dvbsub_display_end_segment(avctx, p, 0, sub);
+
return p - buf;
}
View
3 mythtv/external/FFmpeg/libavcodec/dvdsubdec.c
@@ -367,7 +367,10 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
cmd_pos = next_cmd_pos;
}
if (sub_header->num_rects > 0)
+ {
+ sub_header->forced = is_menu;
return is_menu;
+ }
fail:
if (sub_header->rects != NULL) {
for (i = 0; i < sub_header->num_rects; i++) {
View
6 mythtv/external/FFmpeg/libavcodec/get_bits.h
@@ -135,7 +135,11 @@ for examples see get_bits, show_bits, skip_bits, get_vlc
name##_index < name##_size_plus8
#endif
-#define CLOSE_READER(name, gb) (gb)->index = name##_index
+// Added the void use of the cache to defeat compiler warnings with newer gcc
+// (warning: variable 're_cache" set but not used)
+# define CLOSE_READER(name, gb) \
+ (gb)->index = name##_index; \
+ (void)name##_cache
#ifdef BITSTREAM_READER_LE
View
20 mythtv/external/FFmpeg/libavcodec/mpeg12.c
@@ -2215,14 +2215,14 @@ static void mpeg_decode_user_data(AVCodecContext *avctx,
unsigned int cc_bytes = (cc_bits + 7 - 3) / 8;
Mpeg1Context *s1 = avctx->priv_data;
MpegEncContext *s = &s1->mpeg_enc_ctx;
- if (buf_end - p >= (2+cc_bytes) && (s->tmp_atsc_cc_len + 2 + 3*cc_count) < ATSC_CC_BUF_SIZE) {
- int atsc_cnt_loc = s->tmp_atsc_cc_len;
+ if (buf_end - p >= (2+cc_bytes) && (s->tmp_scte_cc_len + 2 + 3*cc_count) < SCTE_CC_BUF_SIZE) {
+ int scte_cnt_loc = s->tmp_scte_cc_len;
uint8_t real_count = 0, marker = 1, i;
GetBitContext gb;
init_get_bits(&gb, p+2, (buf_end-p-2) * sizeof(uint8_t));
get_bits(&gb, 5); // swallow cc_count
- s->tmp_atsc_cc_buf[s->tmp_atsc_cc_len++] = 0x40 | (0x1f&cc_count);
- s->tmp_atsc_cc_buf[s->tmp_atsc_cc_len++] = 0x00; // em_data
+ s->tmp_scte_cc_buf[s->tmp_scte_cc_len++] = 0x40 | (0x1f&cc_count);
+ s->tmp_scte_cc_buf[s->tmp_scte_cc_len++] = 0x00; // em_data
for (i = 0; i < cc_count; i++) {
uint8_t valid, cc608_hdr;
uint8_t priority = get_bits(&gb, 2);
@@ -2243,18 +2243,18 @@ static void mpeg_decode_user_data(AVCodecContext *avctx,
continue;
cc608_hdr = 0xf8 | (valid ? 0x04 : 0x00) | type;
real_count++;
- s->tmp_atsc_cc_buf[s->tmp_atsc_cc_len++] = cc608_hdr;
- s->tmp_atsc_cc_buf[s->tmp_atsc_cc_len++] = cc_data_1;
- s->tmp_atsc_cc_buf[s->tmp_atsc_cc_len++] = cc_data_2;
+ s->tmp_scte_cc_buf[s->tmp_scte_cc_len++] = cc608_hdr;
+ s->tmp_scte_cc_buf[s->tmp_scte_cc_len++] = cc_data_1;
+ s->tmp_scte_cc_buf[s->tmp_scte_cc_len++] = cc_data_2;
}
if (!real_count)
{
- s->tmp_atsc_cc_len = atsc_cnt_loc;
+ s->tmp_scte_cc_len = scte_cnt_loc;
}
else
{
- s->tmp_atsc_cc_buf[atsc_cnt_loc] = 0x40 | (0x1f&real_count);
- s->tmp_atsc_cc_len = atsc_cnt_loc + 2 + 3 * real_count;
+ s->tmp_scte_cc_buf[scte_cnt_loc] = 0x40 | (0x1f&real_count);
+ s->tmp_scte_cc_len = scte_cnt_loc + 2 + 3 * real_count;
}
}
} else if (buf_end - p >= 11 &&
View
3 mythtv/external/FFmpeg/libavcodec/mpegvideo.c
@@ -1192,6 +1192,9 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
memcpy(pic->f.atsc_cc_buf, s->tmp_atsc_cc_buf, s->tmp_atsc_cc_len);
pic->f.atsc_cc_len = s->tmp_atsc_cc_len;
s->tmp_atsc_cc_len = 0;
+ memcpy(pic->f.scte_cc_buf, s->tmp_scte_cc_buf, s->tmp_scte_cc_len);
+ pic->f.scte_cc_len = s->tmp_scte_cc_len;
+ s->tmp_scte_cc_len = 0;
pic->f.coded_picture_number = s->coded_picture_number++;
View
3 mythtv/external/FFmpeg/libavcodec/mpegvideo.h
@@ -678,6 +678,9 @@ typedef struct MpegEncContext {
/// frame for these packets has been created in MPV_frame_start().
uint8_t tmp_atsc_cc_buf[ATSC_CC_BUF_SIZE];
int tmp_atsc_cc_len;
+#define SCTE_CC_BUF_SIZE 1024
+ uint8_t tmp_scte_cc_buf[SCTE_CC_BUF_SIZE];
+ int tmp_scte_cc_len;
int (*decode_mb)(struct MpegEncContext *s, DCTELEM block[6][64]); // used by some codecs to avoid a switch()
#define SLICE_OK 0
View
4 mythtv/external/FFmpeg/libavcodec/myth_utils.c
@@ -214,6 +214,9 @@ const char *ff_codec_id_string(enum CodecID codec_id)
case CODEC_ID_MPEG2TS: return "MPEG2TS";
+ /* Attachment codecs */
+ case CODEC_ID_TTF: return "TTF font";
+
case CODEC_ID_PROBE: return "PROBE";
}
return "Unknown Codec ID";
@@ -231,6 +234,7 @@ const char *ff_codec_type_string(enum AVMediaType codec_type)
case AVMEDIA_TYPE_AUDIO: return "Audio";
case AVMEDIA_TYPE_DATA: return "Data";
case AVMEDIA_TYPE_SUBTITLE: return "Subtitle";
+ case AVMEDIA_TYPE_ATTACHMENT: return "Attachment";
}
return "Invalid Codec Type";
};
View
3 mythtv/external/FFmpeg/libavcodec/pgssubdec.c
@@ -51,6 +51,7 @@ typedef struct PGSSubPictureReference {
typedef struct PGSSubPresentation {
int id_number;
int object_count;
+ int object_forced;
PGSSubPictureReference *objects;
} PGSSubPresentation;
@@ -342,6 +343,7 @@ static void parse_presentation_segment(AVCodecContext *avctx,
buf++;
/* composition_flag (0x80 - object cropped, 0x40 - object forced) */
reference->composition = bytestream_get_byte(&buf);
+ ctx->presentation.object_forced = (reference->composition & 0x40) >> 6;
reference->x = bytestream_get_be16(&buf);
reference->y = bytestream_get_be16(&buf);
@@ -393,6 +395,7 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
if (!ctx->presentation.object_count)
return 1;
+ sub->forced = ctx->presentation.object_forced;
sub->start_display_time = 0;
sub->end_display_time = 20000;
sub->format = 0;
View
6 mythtv/external/FFmpeg/libavcodec/ppc/asm.S
@@ -70,7 +70,11 @@ X(\name):
.macro movrel rd, sym, gp
#if CONFIG_PIC
- lwz \rd, \sym@got(\gp)
+ bcl 20, 31, lab_pic_\@
+lab_pic_\@:
+ mflr \rd
+ addis \rd, \rd, (\sym - lab_pic_\@)@ha
+ addi \rd, \rd, (\sym - lab_pic_\@)@l
#else
lis \rd, \sym@ha
la \rd, \sym@l(\rd)
View
78 mythtv/external/FFmpeg/libavformat/mpegts.c
@@ -98,6 +98,12 @@ struct MpegTSFilter {
int es_id;
int last_cc; /* last cc code (-1 if first packet) */
enum MpegTSFilterType type;
+ /** if set, chop off PMT at the end of the TS packet, regardless of the
+ * data length given in the packet. This is for use by BBC iPlayer IPTV
+ * recordings which seem to only want to send the first packet of the PMT
+ * but give a length that requires 3 packets. Without this, those
+ * recordings are unplayable */
+ int pmt_chop_at_ts;
union {
MpegTSPESFilter pes_filter;
MpegTSSectionFilter section_filter;
@@ -365,16 +371,30 @@ static void write_section_data(AVFormatContext *s, MpegTSFilter *tss1,
sect->new_packet = 1;
}
while (!tss->end_of_section_reached) {
- /* compute section length if possible */
- if (tss->section_h_size == -1 && tss->section_index >= 3) {
- len = (AV_RB16(tss->section_buf + 1) & 0xfff) + 3;
- if (len > 4096)
- return;
- tss->section_h_size = len;
- }
+ /* compute section length if possible */
+ if (tss->section_h_size == -1 && tss->section_index >= 3) {
+ len = (AV_RB16(tss->section_buf + 1) & 0xfff) + 3;
+ if (len > 4096)
+ return;
+ tss->section_h_size = len;
+ }
- if (tss->section_h_size == -1 || tss->section_index < tss->section_h_size)
- break;
+ if (tss->section_h_size == -1 ||
+ tss->section_index < tss->section_h_size)
+ {
+ if (tss1->pmt_chop_at_ts && tss->section_buf[0] == PMT_TID)
+ {
+ /* HACK! To allow BBC IPTV streams with incomplete PMTs (they
+ * advertise a length of 383, but only send 182 bytes!), we
+ * will not wait for the remainder of the PMT, but accept just
+ * what is in the first TS payload, as this is enough to get
+ * playback, although some PIDs may be filtered out as a result
+ */
+ tss->section_h_size = tss->section_index;
+ }
+ else
+ break;
+ }
if (!tss->check_crc ||
av_crc(av_crc_get_table(AV_CRC_32_IEEE), -1,
@@ -383,7 +403,8 @@ static void write_section_data(AVFormatContext *s, MpegTSFilter *tss1,
if (tss->section_index > tss->section_h_size) {
int left = tss->section_index - tss->section_h_size;
- memmove(tss->section_buf, tss->section_buf+tss->section_h_size, left);
+ memmove(tss->section_buf, tss->section_buf+tss->section_h_size,
+ left);
tss->section_index = left;
tss->section_h_size = -1;
} else {
@@ -419,6 +440,7 @@ static MpegTSFilter *mpegts_open_section_filter(MpegTSContext *ts, unsigned int
filter->pid = pid;
filter->es_id = -1;
filter->last_cc = -1;
+ filter->pmt_chop_at_ts = 0;
sec = &filter->u.section_filter;
sec->section_cb = section_cb;
sec->opaque = opaque;
@@ -1738,7 +1760,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
if (ts->req_sid >= 0 && h->id != ts->req_sid)
{
#ifdef DEBUG
- dprintf(NULL, "We are looking for program 0x%x, not 0x%x",
+ av_dlog(ts->stream, "We are looking for program 0x%x, not 0x%x",
ts->req_sid, h->id);
#endif
return;
@@ -2025,15 +2047,15 @@ static AVStream *new_section_av_stream(SectionContext *sect, enum AVMediaType ty
FF_ALLOCZ_OR_GOTO(NULL, sect->st, sizeof(AVStream), fail);
sect->st->codec = avcodec_alloc_context();
- sect->st->codec->codec_type = type;
- sect->st->codec->codec_id = id;
+ sect->st = av_new_stream(sect->stream, sect->pid);
+
av_set_pts_info(sect->st, 33, 1, 90000);
+ sect->st->codec->codec_type = type;
+ sect->st->codec->codec_id = id;
sect->st->priv_data = sect;
sect->st->need_parsing = AVSTREAM_PARSE_NONE;
- sect->st = av_add_stream(sect->stream, sect->st, sect->pid);
-
return sect->st;
fail: /*for the CHECKED_ALLOCZ macro*/
return NULL;
@@ -2436,7 +2458,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
if(pid && discard_pid(ts, pid))
{
- dprintf(ts->stream, "discarding pid %d\n", pid);
+ av_log(ts->stream, AV_LOG_INFO, "discarding pid %d\n", pid);
return 0;
}
@@ -2703,7 +2725,8 @@ static int mpegts_read_header(AVFormatContext *s)
goto fail;
}
ts->raw_packet_size = get_packet_size(buf, sizeof(buf));
- av_log(NULL, AV_LOG_DEBUG, "mpegts_read_header: TS packet size = %d\n", ts->raw_packet_size);
+ av_log(NULL, AV_LOG_DEBUG, "mpegts_read_header: TS packet size = %d\n",
+ ts->raw_packet_size);
if (ts->raw_packet_size <= 0) {
av_log(s, AV_LOG_WARNING, "Could not detect TS packet size, defaulting to non-FEC/DVHS\n");
ts->raw_packet_size = TS_PACKET_SIZE;
@@ -2744,14 +2767,13 @@ static int mpegts_read_header(AVFormatContext *s)
s->ctx_flags |= AVFMTCTX_NOHEADER;
goto do_pcr;
}
-
+
ts->scanning = 1;
ts->pmt_scan_state = PMT_NOT_YET_FOUND;
/* tune to first service found */
for (i = 0; ((i < ts->nb_prg) &&
(ts->pmt_scan_state == PMT_NOT_YET_FOUND)); i++)
{
-
#ifdef DEBUG
av_log(ts->stream, AV_LOG_DEBUG, "Tuning to pnum: 0x%x\n",
ts->prg[i].id);
@@ -2770,8 +2792,7 @@ static int mpegts_read_header(AVFormatContext *s)
(ts->pmt_scan_state == PMT_NOT_YET_FOUND))
{
av_log(NULL, AV_LOG_ERROR,
- "Tuning to pnum: 0x%x "
- "without CRC check on PMT\n",
+ "Tuning to pnum: 0x%x without CRC check on PMT\n",
ts->prg[i].id);
/* turn off crc checking */
ts->pmt_filter->u.section_filter.check_crc = 0;
@@ -2780,6 +2801,21 @@ static int mpegts_read_header(AVFormatContext *s)
ts->req_sid = sid = ts->prg[i].id;
handle_packets(ts, s->probesize / ts->raw_packet_size);
}
+
+ /* fallback code to deal with streams that are not complete PMT
+ * streams (BBC iPlayer IPTV as an example) */
+ if (ts->pmt_filter &&
+ (ts->pmt_scan_state == PMT_NOT_YET_FOUND))
+ {
+ av_log(NULL, AV_LOG_ERROR,
+ "Overriding PMT data length, using "
+ "contents of first TS packet only!\n");
+ ts->pmt_filter->pmt_chop_at_ts = 1;
+ /* try again */
+ url_fseek(pb, pos, SEEK_SET);
+ ts->req_sid = sid = ts->prg[i].id;
+ handle_packets(ts, s->probesize / ts->raw_packet_size);
+ }
}
ts->scanning = 0;
View
10 mythtv/external/FFmpeg/libavformat/utils.c
@@ -2509,7 +2509,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
}
for (i=0; i<ic->nb_streams; i++) {
- ic->streams[i]->info->last_dts = AV_NOPTS_VALUE;
+ if (ic->streams[i]->info )
+ ic->streams[i]->info->last_dts = AV_NOPTS_VALUE;
}
count = 0;
@@ -2563,6 +2564,13 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
flush_codecs = 0;
break;
}
+ /* Is this is an MHEG only stream? Then we really can stop. */
+ if (i == 1 && ic->streams[0]->codec->codec_id == CODEC_ID_DSMCC_B)
+ {
+ ret = count;
+ av_log(ic, AV_LOG_DEBUG, "All DSM info found\n");
+ break;
+ }
}
/* we did not get all the codec info, but we read too much data */
if (read_size >= ic->probesize) {

0 comments on commit 940dd94

Please sign in to comment.