]>
Commit | Line | Data |
---|---|---|
9cf5dcbc JB |
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 | |
3 | @@ -24,6 +24,7 @@ | |
4 | ||
5 | #include "ffmpeg_in.h" | |
6 | #include <gpac/avparse.h> | |
7 | +#include <libavutil/avutil.h> | |
8 | ||
9 | static AVCodec *ffmpeg_get_codec(u32 codec_4cc) | |
10 | { | |
11 | @@ -111,7 +112,7 @@ | |
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); | |
20 | @@ -121,7 +122,7 @@ | |
21 | /*ffmpeg specific*/ | |
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); | |
28 | } | |
29 | @@ -138,7 +139,7 @@ | |
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); | |
38 | @@ -151,7 +152,7 @@ | |
39 | ffd->ctx->frame_size = 160; | |
40 | } | |
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); | |
46 | } | |
47 | @@ -163,7 +164,7 @@ | |
48 | else { | |
49 | u32 codec_id = 0; | |
50 | if (ffd->st==GF_STREAM_VISUAL) { | |
51 | - ffd->ctx->codec_type = CODEC_TYPE_VIDEO; | |
52 | + ffd->ctx->codec_type = AVMEDIA_TYPE_VIDEO; | |
53 | switch (ffd->oti) { | |
54 | case 0x20: | |
55 | codec_id = CODEC_ID_MPEG4; | |
56 | @@ -190,7 +191,7 @@ | |
57 | break; | |
58 | } | |
59 | } else if (ffd->st==GF_STREAM_AUDIO) { | |
60 | - ffd->ctx->codec_type = CODEC_TYPE_AUDIO; | |
61 | + ffd->ctx->codec_type = AVMEDIA_TYPE_AUDIO; | |
62 | switch (ffd->oti) { | |
63 | case 0x69: | |
64 | case 0x6B: | |
65 | @@ -412,20 +413,20 @@ | |
66 | ||
67 | /*WARNING: this breaks H264 (and maybe others) decoding, disabled for now*/ | |
68 | #if 1 | |
69 | - if (!ffd->ctx->hurry_up) { | |
70 | + if (ffd->ctx->skip_frame < AVDISCARD_NONREF) { | |
71 | switch (mmlevel) { | |
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; | |
77 | break; | |
78 | case GF_CODEC_LEVEL_VERY_LATE: | |
79 | case GF_CODEC_LEVEL_LATE: | |
80 | /*skip B-frames*/ | |
81 | - ffd->ctx->hurry_up = 1; | |
82 | + ffd->ctx->skip_frame = AVDISCARD_NONREF; | |
83 | break; | |
84 | default: | |
85 | - ffd->ctx->hurry_up = 0; | |
86 | + ffd->ctx->skip_frame = AVDISCARD_DEFAULT; | |
87 | break; | |
88 | } | |
89 | } | |
90 | @@ -451,7 +452,7 @@ | |
91 | if (len<0) { ffd->frame_start = 0; return GF_NON_COMPLIANT_BITSTREAM; } | |
92 | if (gotpic<0) { ffd->frame_start = 0; return GF_OK; } | |
93 | ||
94 | - ffd->ctx->hurry_up = 0; | |
95 | + ffd->ctx->skip_frame = AVDISCARD_DEFAULT; | |
96 | ||
97 | if (ffd->ctx->frame_size < gotpic) ffd->ctx->frame_size = gotpic; | |
98 | ||
99 | @@ -552,7 +553,7 @@ | |
100 | } | |
101 | } | |
102 | } | |
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 | |
110 | @@ -31,6 +31,7 @@ | |
111 | #if !defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) | |
112 | #include <errno.h> | |
113 | #endif | |
114 | +#include <libavutil/avutil.h> | |
115 | ||
116 | static u32 FFDemux_Run(void *par) | |
117 | { | |
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; | |
125 | break; | |
126 | - case CODEC_TYPE_VIDEO: | |
127 | + case AVMEDIA_TYPE_VIDEO: | |
128 | if (!has_video) has_video= 1; | |
129 | break; | |
130 | default: | |
131 | @@ -531,10 +532,10 @@ | |
132 | ||
133 | switch (i) { | |
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; | |
143 | } | |
144 | ||
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)) { | |
152 | ffd->audio_st = i; | |
153 | ffd->audio_tscale = ffd->ctx->streams[i]->time_base; | |
154 | } | |
155 | break; | |
156 | - case CODEC_TYPE_VIDEO: | |
157 | + case AVMEDIA_TYPE_VIDEO: | |
158 | if ((ffd->video_st<0) && (ffd->service_type!=2)) { | |
159 | ffd->video_st = i; | |
160 | ffd->video_tscale = ffd->ctx->streams[i]->time_base; |