1 --- gpac/modules/ffmpeg_in/ffmpeg_decode.c.orig 2011-06-27 18:51:07.878588020 +0200
2 +++ gpac/modules/ffmpeg_in/ffmpeg_decode.c 2011-06-27 20:18:43.345430660 +0200
6 #include <gpac/avparse.h>
7 +#include <libavutil/avutil.h>
9 static AVCodec *ffmpeg_get_codec(u32 codec_4cc)
12 bs = gf_bs_new(esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength, GF_BITSTREAM_READ);
13 codec_id = gf_bs_read_u32(bs);
14 if (ffd->st==GF_STREAM_AUDIO) {
15 - ffd->ctx->codec_type = CODEC_TYPE_AUDIO;
16 + ffd->ctx->codec_type = AVMEDIA_TYPE_AUDIO;
17 ffd->ctx->sample_rate = gf_bs_read_u32(bs);
18 ffd->ctx->channels = gf_bs_read_u16(bs);
19 ffd->ctx->frame_size = gf_bs_read_u16(bs);
22 ffd->ctx->block_align = gf_bs_read_u16(bs);
23 } else if (ffd->st==GF_STREAM_VISUAL) {
24 - ffd->ctx->codec_type = CODEC_TYPE_VIDEO;
25 + ffd->ctx->codec_type = AVMEDIA_TYPE_VIDEO;
26 ffd->ctx->width = gf_bs_read_u16(bs);
27 ffd->ctx->height = gf_bs_read_u16(bs);
30 bs = gf_bs_new(esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength, GF_BITSTREAM_READ);
31 codec_id = gf_bs_read_u32(bs);
32 if (ffd->st==GF_STREAM_AUDIO) {
33 - ffd->ctx->codec_type = CODEC_TYPE_AUDIO;
34 + ffd->ctx->codec_type = AVMEDIA_TYPE_AUDIO;
35 ffd->ctx->sample_rate = gf_bs_read_u32(bs);
36 ffd->ctx->channels = gf_bs_read_u16(bs);
37 ffd->ctx->frame_size = gf_bs_read_u16(bs);
39 ffd->ctx->frame_size = 160;
41 } else if (ffd->st==GF_STREAM_VISUAL) {
42 - ffd->ctx->codec_type = CODEC_TYPE_VIDEO;
43 + ffd->ctx->codec_type = AVMEDIA_TYPE_VIDEO;
44 ffd->ctx->width = gf_bs_read_u16(bs);
45 ffd->ctx->height = gf_bs_read_u16(bs);
50 if (ffd->st==GF_STREAM_VISUAL) {
51 - ffd->ctx->codec_type = CODEC_TYPE_VIDEO;
52 + ffd->ctx->codec_type = AVMEDIA_TYPE_VIDEO;
55 codec_id = CODEC_ID_MPEG4;
59 } else if (ffd->st==GF_STREAM_AUDIO) {
60 - ffd->ctx->codec_type = CODEC_TYPE_AUDIO;
61 + ffd->ctx->codec_type = AVMEDIA_TYPE_AUDIO;
67 /*WARNING: this breaks H264 (and maybe others) decoding, disabled for now*/
69 - if (!ffd->ctx->hurry_up) {
70 + if (ffd->ctx->skip_frame < AVDISCARD_NONREF) {
72 case GF_CODEC_LEVEL_SEEK:
73 case GF_CODEC_LEVEL_DROP:
74 /*skip as much as possible*/
75 - ffd->ctx->hurry_up = 5;
76 + ffd->ctx->skip_frame = AVDISCARD_NONKEY;
78 case GF_CODEC_LEVEL_VERY_LATE:
79 case GF_CODEC_LEVEL_LATE:
81 - ffd->ctx->hurry_up = 1;
82 + ffd->ctx->skip_frame = AVDISCARD_NONREF;
85 - ffd->ctx->hurry_up = 0;
86 + ffd->ctx->skip_frame = AVDISCARD_DEFAULT;
91 if (len<0) { ffd->frame_start = 0; return GF_NON_COMPLIANT_BITSTREAM; }
92 if (gotpic<0) { ffd->frame_start = 0; return GF_OK; }
94 - ffd->ctx->hurry_up = 0;
95 + ffd->ctx->skip_frame = AVDISCARD_DEFAULT;
97 if (ffd->ctx->frame_size < gotpic) ffd->ctx->frame_size = gotpic;
103 - ffd->ctx->hurry_up = 0;
104 + ffd->ctx->skip_frame = AVDISCARD_DEFAULT;
105 /*recompute outsize in case on-the-fly change*/
106 if ((w != ffd->ctx->width) || (h != ffd->ctx->height)) {
107 outsize = ffd->ctx->width * ffd->ctx->height * 3;
108 --- gpac/modules/ffmpeg_in/ffmpeg_demux.c.orig 2008-11-28 18:21:48.000000000 +0100
109 +++ gpac/modules/ffmpeg_in/ffmpeg_demux.c 2011-06-27 21:20:51.252222149 +0200
111 #if !defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
114 +#include <libavutil/avutil.h>
116 static u32 FFDemux_Run(void *par)
118 @@ -233,10 +234,10 @@
119 for(i = 0; i < ctx->nb_streams; i++) {
120 AVCodecContext *enc = ctx->streams[i]->codec;
121 switch(enc->codec_type) {
122 - case CODEC_TYPE_AUDIO:
123 + case AVMEDIA_TYPE_AUDIO:
124 if (!has_audio) has_audio = 1;
126 - case CODEC_TYPE_VIDEO:
127 + case AVMEDIA_TYPE_VIDEO:
128 if (!has_video) has_video= 1;
131 @@ -531,10 +532,10 @@
134 case 0: e = GF_OK; break;
135 - case AVERROR_IO: e = GF_URL_ERROR; goto err_exit;
136 + case AVERROR(EIO): e = GF_URL_ERROR; goto err_exit;
137 case AVERROR_INVALIDDATA: e = GF_NON_COMPLIANT_BITSTREAM; goto err_exit;
138 - case AVERROR_NOMEM: e = GF_OUT_OF_MEM; goto err_exit;
139 - case AVERROR_NOFMT: e = GF_NOT_SUPPORTED; goto err_exit;
140 + case AVERROR(ENOMEM): e = GF_OUT_OF_MEM; goto err_exit;
141 + case AVERROR(EILSEQ): e = GF_NOT_SUPPORTED; goto err_exit;
142 default: e = GF_SERVICE_ERROR; goto err_exit;
145 @@ -552,13 +553,13 @@
146 for (i = 0; i < ffd->ctx->nb_streams; i++) {
147 AVCodecContext *enc = ffd->ctx->streams[i]->codec;
148 switch(enc->codec_type) {
149 - case CODEC_TYPE_AUDIO:
150 + case AVMEDIA_TYPE_AUDIO:
151 if ((ffd->audio_st<0) && (ffd->service_type!=1)) {
153 ffd->audio_tscale = ffd->ctx->streams[i]->time_base;
156 - case CODEC_TYPE_VIDEO:
157 + case AVMEDIA_TYPE_VIDEO:
158 if ((ffd->video_st<0) && (ffd->service_type!=2)) {
160 ffd->video_tscale = ffd->ctx->streams[i]->time_base;