]> git.pld-linux.org Git - packages/gpac.git/blob - gpac-ffmpeg2.patch
- rebuild with DirectFB 1.7.2
[packages/gpac.git] / gpac-ffmpeg2.patch
1 Index: modules/ffmpeg_in/ffmpeg_in.h
2 ===================================================================
3 --- modules/ffmpeg_in/ffmpeg_in.h       (revision 4282)
4 +++ modules/ffmpeg_in/ffmpeg_in.h       (revision 4451)
5 @@ -120,7 +120,7 @@
6  
7         /*for audio packed frames*/
8         u32 frame_start;
9 -       char audio_buf[AVCODEC_MAX_AUDIO_FRAME_SIZE];
10 +       char audio_buf[192000];
11         Bool check_h264_isma;
12  
13         u32 base_ES_ID;
14 Index: modules/ffmpeg_in/ffmpeg_demux.c
15 ===================================================================
16 --- modules/ffmpeg_in/ffmpeg_demux.c    (revision 4282)
17 +++ modules/ffmpeg_in/ffmpeg_demux.c    (revision 4451)
18 @@ -53,6 +53,18 @@
19  #define AVERROR_NOFMT AVERROR(EINVAL)
20  #endif /* AVERROR_NOFMT */
21  
22 +
23 +#if (LIBAVFORMAT_VERSION_MAJOR >= 54) && (LIBAVFORMAT_VERSION_MINOR >= 20)
24 +
25 +#define av_find_stream_info(__c)       avformat_find_stream_info(__c, NULL)
26 +#ifndef FF_API_FORMAT_PARAMETERS
27 +#define FF_API_FORMAT_PARAMETERS       1
28 +#endif
29 +
30 +#endif
31 +
32 +
33 +
34  static u32 FFDemux_Run(void *par)
35  {
36         AVPacket pkt;
37 Index: modules/ffmpeg_in/ffmpeg_decode.c
38 ===================================================================
39 --- modules/ffmpeg_in/ffmpeg_decode.c   (revision 4282)
40 +++ modules/ffmpeg_in/ffmpeg_decode.c   (revision 4451)
41 @@ -38,8 +38,14 @@
42  #undef USE_AVCODEC2
43  #endif
44  
45 +#if (LIBAVCODEC_VERSION_MAJOR >= 55) 
46 +#define USE_AVCTX3
47 +#elif (LIBAVCODEC_VERSION_MAJOR >= 54) && (LIBAVCODEC_VERSION_MINOR >= 35)
48 +#define USE_AVCTX3
49 +#endif
50  
51  
52 +
53  /**
54   * Allocates data for FFMPEG decoding
55   * \param oldBuffer The oldBuffer (freed if not NULL)
56 @@ -170,7 +176,12 @@
57                 frame = &ffd->base_frame;
58         }
59         if (!(*ctx)){
60 +
61 +#ifdef USE_AVCTX3
62 +         *ctx = avcodec_alloc_context3(NULL);
63 +#else
64           *ctx = avcodec_alloc_context();
65 +#endif
66         }
67  
68         /*private FFMPEG DSI*/
69 @@ -318,7 +329,11 @@
70                 (*ctx)->pix_fmt = ffd->raw_pix_fmt;
71                 if ((*ctx)->extradata && strstr((*ctx)->extradata, "BottomUp")) ffd->flipped = 1;
72         } else {
73 +#ifdef USE_AVCTX3
74 +               if (avcodec_open2((*ctx), (*codec), NULL )<0) return GF_NON_COMPLIANT_BITSTREAM;
75 +#else
76                 if (avcodec_open((*ctx), (*codec) )<0) return GF_NON_COMPLIANT_BITSTREAM;
77 +#endif
78         }
79  
80         /*setup audio streams*/
81 @@ -612,10 +627,11 @@
82                 if (ffd->frame_start>inBufferLength) ffd->frame_start = 0;
83  
84  redecode:
85 -               gotpic = AVCODEC_MAX_AUDIO_FRAME_SIZE;
86  #ifdef USE_AVCODEC2
87 +               gotpic = 0;
88                 len = avcodec_decode_audio3(ctx, (short *)ffd->audio_buf, &gotpic, &pkt);
89  #else
90 +               gotpic = AVCODEC_MAX_AUDIO_FRAME_SIZE;
91                 len = avcodec_decode_audio2(ctx, (short *)ffd->audio_buf, &gotpic, inBuffer + ffd->frame_start, inBufferLength - ffd->frame_start);
92  #endif
93                 if (len<0) { ffd->frame_start = 0; return GF_NON_COMPLIANT_BITSTREAM; }
94 @@ -755,7 +771,13 @@
95                         here this means the DSI was broken, so no big deal*/
96                         avcodec_close(ctx);
97                         *codec = avcodec_find_decoder(CODEC_ID_H263);
98 +
99 +#ifdef USE_AVCTX3
100 +                       if (! (*codec) || (avcodec_open2(ctx, *codec, NULL)<0)) return GF_NON_COMPLIANT_BITSTREAM;
101 +#else
102                         if (! (*codec) || (avcodec_open(ctx, *codec)<0)) return GF_NON_COMPLIANT_BITSTREAM;
103 +#endif
104 +
105  #if USE_AVCODEC2
106                         if (avcodec_decode_video2(ctx, frame, &gotpic, &pkt) < 0) {
107  #else
108 @@ -765,7 +787,11 @@
109                                 avcodec_close(ctx);
110                                 *codec = avcodec_find_decoder(old_codec);
111                                 assert(*codec);
112 +#ifdef USE_AVCTX3
113 +                               avcodec_open2(ctx, *codec, NULL);
114 +#else
115                                 avcodec_open(ctx, *codec);
116 +#endif
117                                 return GF_NON_COMPLIANT_BITSTREAM;
118                         }
119                 }
This page took 0.226759 seconds and 3 git commands to generate.