Permalink
Browse files

Make it compile at least the ffmpeg part

  • Loading branch information...
Beirdo committed Apr 1, 2012
1 parent 52be988 commit 9cb02dee588127240fb8a843ed92347a33c7e0e1
View

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1,6 +1,7 @@
include config.mak
SRC_DIR = $(SRC_PATH_BARE)
+SRC_PATH = $(SRC_PATH_BARE)/external/FFmpeg
vpath %.c $(SRC_PATH_BARE)
vpath %.cpp $(SRC_PATH_BARE)
@@ -82,9 +83,9 @@ endef
define DOSUBDIR
$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
SUBDIR := $(1)/
-include $(SRC_PATH)/$(1)/Makefile
--include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
-include $(SRC_PATH)/library.mak
+include $(SRC_PATH_BARE)/external/FFmpeg/$(1)/Makefile
+-include $(SRC_PATH_BARE)/external/FFmpeg/$(1)/$(ARCH)/Makefile
+include $(SRC_PATH_BARE)/external/FFmpeg/library.mak
endef
$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
@@ -79,7 +79,7 @@ OBJS += $(OBJS-yes)
FFLIBS := $(FFLIBS-yes) $(FFLIBS)
TESTPROGS += $(TESTPROGS-yes)
-FFEXTRALIBS := $(FFLIBS:%=-l%$(BUILDSUF)) $(EXTRALIBS)
+FFEXTRALIBS := $(FFLIBS:%=-lmyth%$(BUILDSUF)) $(EXTRALIBS)
EXAMPLES := $(EXAMPLES:%=$(SUBDIR)%-example$(EXESUF))
OBJS := $(sort $(OBJS:%=$(SUBDIR)%))
@@ -129,7 +129,7 @@ static int latm_read_audio_specific_config(GetBitContext *gb,
c->object_type = audio_object_type;
c->sampling_index = copy_bits(pb, gb, 4);
- c->sample_rate = ff_mpeg4audio_sample_rates[c->sampling_index];
+ c->sample_rate = avpriv_mpeg4audio_sample_rates[c->sampling_index];
if (c->sampling_index == 0x0f) {
c->sample_rate = copy_bits(pb, gb, 24);
}
@@ -148,7 +148,7 @@ static int latm_read_audio_specific_config(GetBitContext *gb,
} else if (audio_object_type == AOT_SBR) {
c->sbr = 1;
c->ext_sampling_index = copy_bits(pb, gb, 4);
- c->ext_sample_rate = ff_mpeg4audio_sample_rates[c->ext_sampling_index];
+ c->ext_sample_rate = avpriv_mpeg4audio_sample_rates[c->ext_sampling_index];
if (c->ext_sampling_index == 0x0f) {
c->ext_sample_rate = copy_bits(pb, gb, 24);
}
@@ -419,16 +419,16 @@ static int latm_decode_close(AVCodecContext *avctx)
AVCodec aac_latm_decoder = {
.name = "aac_latm",
- .type = CODEC_TYPE_AUDIO,
+ .type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_AAC_LATM,
.priv_data_size = sizeof(struct LATMContext),
.init = latm_decode_init,
.close = latm_decode_close,
.decode = latm_decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Codec LATM "
"syntax)"),
- .sample_fmts = (const enum SampleFormat[]) {
- SAMPLE_FMT_S16,SAMPLE_FMT_NONE
+ .sample_fmts = (const enum AVSampleFormat[]) {
+ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
},
.channel_layouts = aac_channel_layout,
};
@@ -4563,6 +4563,6 @@ int av_codec_is_encoder(AVCodec *codec);
int av_codec_is_decoder(AVCodec *codec);
const char *ff_codec_id_string(enum CodecID codec_id);
-const char *ff_codec_type_string(enum CodecType codec_type);
+const char *ff_codec_type_string(enum AVMediaType codec_type);
#endif /* AVCODEC_AVCODEC_H */
@@ -95,7 +95,9 @@ const char *ff_codec_id_string(enum CodecID codec_id)
case CODEC_ID_QDRAW: return "QDRAW";
case CODEC_ID_VIXL: return "VIXL";
case CODEC_ID_QPEG: return "QPEG";
+#if 0
case CODEC_ID_XVID: return "XVID";
+#endif
case CODEC_ID_PNG: return "PNG";
case CODEC_ID_PPM: return "PPM";
case CODEC_ID_PBM: return "PBM";
@@ -220,15 +222,15 @@ const char *ff_codec_id_string(enum CodecID codec_id)
/** \fn codec_type_string(enum CodecType)
* returns a human readable string for the CodecType enum.
*/
-const char *ff_codec_type_string(enum CodecType codec_type)
+const char *ff_codec_type_string(enum AVMediaType codec_type)
{
switch (codec_type)
{
- case CODEC_TYPE_UNKNOWN: return "Unknown";
- case CODEC_TYPE_VIDEO: return "Video";
- case CODEC_TYPE_AUDIO: return "Audio";
- case CODEC_TYPE_DATA: return "Data";
- case CODEC_TYPE_SUBTITLE: return "Subtitle";
+ case AVMEDIA_TYPE_UNKNOWN: return "Unknown";
+ case AVMEDIA_TYPE_VIDEO: return "Video";
+ case AVMEDIA_TYPE_AUDIO: return "Audio";
+ case AVMEDIA_TYPE_DATA: return "Data";
+ case AVMEDIA_TYPE_SUBTITLE: return "Subtitle";
}
return "Invalid Codec Type";
};
@@ -1102,6 +1102,7 @@ typedef struct AVPacketList {
struct AVPacketList *next;
} AVPacketList;
+#define MAX_STREAMS 100
/**
* @defgroup lavf_core Core functions
@@ -468,7 +468,7 @@ static int mpegps_read_packet(AVFormatContext *s,
type = AVMEDIA_TYPE_AUDIO;
} else if(es_type == STREAM_TYPE_AUDIO_AAC_LATM){
codec_id = CODEC_ID_AAC_LATM;
- type = CODEC_TYPE_AUDIO;
+ type = AVMEDIA_TYPE_AUDIO;
} else if(es_type == STREAM_TYPE_VIDEO_MPEG4){
codec_id = CODEC_ID_MPEG4;
type = AVMEDIA_TYPE_VIDEO;
@@ -517,7 +517,7 @@ static int mpegps_read_packet(AVFormatContext *s,
type = AVMEDIA_TYPE_SUBTITLE;
codec_id = CODEC_ID_DVD_SUBTITLE;
} else if (startcode == 0x69 || startcode == 0x49) {
- type = CODEC_TYPE_DATA;
+ type = AVMEDIA_TYPE_DATA;
codec_id = CODEC_ID_MPEG2VBI;
} else if (startcode >= 0xfd55 && startcode <= 0xfd5f) {
type = AVMEDIA_TYPE_VIDEO;
@@ -716,10 +716,10 @@ static const StreamType HDMV_types[] = {
/* ATSC ? */
static const StreamType MISC_types[] = {
- { 0x81, AVMEDIA_TYPE_AUDIO, CODEC_ID_AC3 },
- { 0x8a, AVMEDIA_TYPE_AUDIO, CODEC_ID_DTS },
- { 0x100, CODEC_TYPE_SUBTITLE, CODEC_ID_DVB_SUBTITLE },
- { 0x101, CODEC_TYPE_DATA, CODEC_ID_DVB_VBI },
+ { 0x81, AVMEDIA_TYPE_AUDIO, CODEC_ID_AC3 },
+ { 0x8a, AVMEDIA_TYPE_AUDIO, CODEC_ID_DTS },
+ { 0x100, AVMEDIA_TYPE_SUBTITLE, CODEC_ID_DVB_SUBTITLE },
+ { 0x101, AVMEDIA_TYPE_DATA, CODEC_ID_DVB_VBI },
{ 0 },
};
@@ -749,8 +749,8 @@ static const StreamType DESC_types[] = {
/* component tags */
static const StreamType COMPONENT_TAG_types[] = {
- { 0x0a, CODEC_TYPE_AUDIO, CODEC_ID_MP3 },
- { 0x52, CODEC_TYPE_VIDEO, CODEC_ID_MPEG2VIDEO },
+ { 0x0a, AVMEDIA_TYPE_AUDIO, CODEC_ID_MP3 },
+ { 0x52, AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG2VIDEO },
};
static void mpegts_find_stream_type(AVStream *st,
@@ -1533,14 +1533,15 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, pmt_entry_t *item, int stream
language[1] = get8(pp, desc_end);
language[2] = get8(pp, desc_end);
language[3] = 0;
- av_dict_set(&st->metadata, "language", language, 0);
break;
case 0x59: /* subtitling descriptor */
language[0] = get8(pp, desc_end);
language[1] = get8(pp, desc_end);
language[2] = get8(pp, desc_end);
language[3] = 0;
+ get8(pp, desc_end);
+#if 0
/* hearing impaired subtitles detection */
switch(get8(pp, desc_end)) {
case 0x20: /* DVB subtitles (for the hard of hearing) with no monitor aspect ratio criticality */
@@ -1552,6 +1553,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, pmt_entry_t *item, int stream
st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED;
break;
}
+#endif
dvbci->comp_page = get16(pp, desc_end);
dvbci->anc_page = get16(pp, desc_end);
@@ -1570,7 +1572,6 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, pmt_entry_t *item, int stream
}
#endif
*pp += 4;
- av_dict_set(&st->metadata, "language", language, 0);
break;
case 0x0a: /* ISO 639 language descriptor */
for (i = 0; i + 4 <= desc_len; i += 4) {
@@ -1584,13 +1585,13 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, pmt_entry_t *item, int stream
case 0x02: st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED; break;
case 0x03: st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; break;
}
- }
+ }
#else
+ }
get8(pp, desc_end);
#endif
if (i) {
language[i - 1] = 0;
- av_dict_set(&st->metadata, "language", language, 0);
}
break;
case 0x05: /* registration descriptor */
@@ -1600,9 +1601,11 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, pmt_entry_t *item, int stream
stream_type == STREAM_TYPE_PRIVATE_DATA)
mpegts_find_stream_type_pmt(item, dvbci->codec_tag, REGD_types);
break;
+#if 0
case 0x52: /* stream identifier descriptor */
st->stream_identifier = 1 + get8(pp, desc_end);
break;
+#endif
case DVB_BROADCAST_ID:
dvbci->data_id = get16(pp, desc_end);
break;
@@ -1644,7 +1647,8 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, pmt_entry_t *item, int stream
return 0;
}
-static int find_in_list(const int *pids, int pid) {
+static int find_in_list(const int *pids, int pid)
+{
int i;
for (i=0; i<PMT_PIDS_MAX; i++)
if (pids[i]==pid)
@@ -1657,12 +1661,12 @@ static int is_desired_stream(pmt_entry_t *item)
int val = 0;
switch (item->codec_type)
{
- case CODEC_TYPE_VIDEO:
- case CODEC_TYPE_AUDIO:
- case CODEC_TYPE_SUBTITLE:
+ case AVMEDIA_TYPE_VIDEO:
+ case AVMEDIA_TYPE_AUDIO:
+ case AVMEDIA_TYPE_SUBTITLE:
val = 1;
break;
- case CODEC_TYPE_DATA:
+ case AVMEDIA_TYPE_DATA:
switch (item->codec_id)
{
case CODEC_ID_DSMCC_B:
@@ -1711,7 +1715,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
// initialize to codec_type_unknown
for (int i=0; i < PMT_PIDS_MAX; i++)
- items[i].codec_type = CODEC_TYPE_UNKNOWN;
+ items[i].codec_type = AVMEDIA_TYPE_UNKNOWN;
mpegts_cleanup_streams(ts); /* in case someone else removed streams.. */
@@ -1779,7 +1783,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
}
p += program_info_length;
if (p >= p_end)
- goto out;
+ return;
// stop parsing after pmt, we found header
if (!ts->stream->nb_streams)
@@ -1880,9 +1884,6 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
ts->pmt_scan_state = PMT_FOUND;
ts->stop_parse = 1;
}
-
-out:
- av_free(mp4_dec_config_descr);
}
static int is_pat_same(MpegTSContext *mpegts_ctx,
@@ -2018,7 +2019,7 @@ static void mpegts_cleanup_streams(MpegTSContext *ts)
}
}
-static AVStream *new_section_av_stream(SectionContext *sect, enum CodecType type,
+static AVStream *new_section_av_stream(SectionContext *sect, enum AVMediaType type,
enum CodecID id)
{
FF_ALLOCZ_OR_GOTO(NULL, sect->st, sizeof(AVStream), fail);
@@ -2304,7 +2305,6 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
}
}
-#if 0
static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len)
{
MpegTSContext *ts = filter->u.section_filter.opaque;
@@ -2381,7 +2381,6 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
p = desc_list_end;
}
}
-#endif
static SectionContext *add_section_stream(MpegTSContext *ts, int pid, int stream_type)
{
@@ -126,7 +126,7 @@ typedef struct
int pid;
int type;
enum CodecID codec_id;
- enum CodecType codec_type;
+ enum AVMediaType codec_type;
dvb_caption_info_t dvbci;
} pmt_entry_t;
@@ -2545,9 +2545,9 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
break;
if(st->first_dts == AV_NOPTS_VALUE && st->codec->codec_id != CODEC_ID_DSMCC_B)
break;
- if (st->codec->codec_type == CODEC_TYPE_VIDEO)
+ if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
hasvideo = 1;
- else if (st->codec->codec_type == CODEC_TYPE_AUDIO)
+ else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
hasaudio = 1;
}
if (i == ic->nb_streams) {
@@ -3126,11 +3126,13 @@ void av_remove_stream(AVFormatContext *s, int id, int remove_ts) {
avcodec_close(codec_ctx);
av_free(codec_ctx);
}
+#if 0
/* make sure format context is not using the codec context */
if (&s->streams[i] == s->cur_st) {
av_log(NULL, AV_LOG_DEBUG, "av_remove_stream cur_st = NULL\n");
s->cur_st = NULL;
}
+#endif
/* else if (s->cur_st > &s->streams[i]) {
av_log(NULL, AV_LOG_DEBUG, "av_remove_stream cur_st -= 1\n");
s->cur_st -= sizeof(AVFormatContext *);

0 comments on commit 9cb02de

Please sign in to comment.