]> git.pld-linux.org Git - packages/StepMania.git/blob - StepMania-3.9-ffmpeg.patch
- cleanup
[packages/StepMania.git] / StepMania-3.9-ffmpeg.patch
1 --- src/arch/MovieTexture/MovieTexture_FFMpeg.cpp.ori   2005-12-29 16:54:24.744730500 +0100
2 +++ src/arch/MovieTexture/MovieTexture_FFMpeg.cpp       2005-12-29 16:56:23.100127250 +0100
3 @@ -307,7 +307,11 @@
4                 if ( GetNextTimestamp )
5                 {
6                         if (pkt.dts != int64_t(AV_NOPTS_VALUE))
7 +#if (LIBAVCODEC_BUILD >= 4754)
8 +                               pts = (float)pkt.dts * m_stream->time_base.num / m_stream->time_base.den;
9 +#else
10                                 pts = (float)pkt.dts / AV_TIME_BASE;
11 +#endif
12                         else
13                                 pts = -1;
14                         GetNextTimestamp = false;
15 @@ -326,7 +326,11 @@
16                  * to give it a buffer to read from since it tries to read anyway. */
17                 static uint8_t dummy[FF_INPUT_BUFFER_PADDING_SIZE] = { 0 };
18                 int len = avcodec::avcodec_decode_video(
19 +#if (LIBAVCODEC_BUILD >= 4754)
20 +                               m_stream->codec, 
21 +#else
22                                 &m_stream->codec, 
23 +#endif
24                                 &frame, &got_frame,
25                                 pkt.size? pkt.data:dummy, pkt.size );
26                 CHECKPOINT;
27 @@ -360,7 +364,11 @@
28                 }
29  
30                 /* Length of this frame: */
31 +#if (LIBAVCODEC_BUILD >= 4754)
32 +               LastFrameDelay = (float)m_stream->codec->time_base.num / m_stream->codec->time_base.den;
33 +#else
34                 LastFrameDelay = (float)m_stream->codec.frame_rate_base / m_stream->codec.frame_rate;
35 +#endif
36                 LastFrameDelay += frame.repeat_pict * (LastFrameDelay * 0.5f);
37  
38                 return 1;
39 @@ -377,9 +385,15 @@
40         pict.data[0] = (unsigned char *)m_img->pixels;
41         pict.linesize[0] = m_img->pitch;
42  
43 +#if (LIBAVCODEC_BUILD >= 4754)
44 +       avcodec::img_convert(&pict, AVPixelFormats[m_AVTexfmt].pf,
45 +                       (avcodec::AVPicture *) &decoder->frame, decoder->m_stream->codec->pix_fmt, 
46 +                       decoder->m_stream->codec->width, decoder->m_stream->codec->height);
47 +#else
48         avcodec::img_convert(&pict, AVPixelFormats[m_AVTexfmt].pf,
49                         (avcodec::AVPicture *) &decoder->frame, decoder->m_stream->codec.pix_fmt, 
50                         decoder->m_stream->codec.width, decoder->m_stream->codec.height);
51 +#endif
52  
53         m_ImageWaiting = FRAME_WAITING;
54  }
55 @@ -389,8 +403,13 @@
56      for( int stream = 0; stream < m_fctx->nb_streams; ++stream )
57         {
58                 avcodec::AVStream *enc = m_fctx->streams[stream];
59 +#if (LIBAVCODEC_BUILD >= 4754)
60 +        if( enc->codec->codec_type == avcodec::CODEC_TYPE_VIDEO )
61 +                       return enc;
62 +#else
63          if( enc->codec.codec_type == avcodec::CODEC_TYPE_VIDEO )
64                         return enc;
65 +#endif
66         }
67         return NULL;
68  }
69 @@ -418,8 +437,13 @@
70         m_bThreaded = PREFSMAN->m_bThreadedMovieDecode;
71  
72         CreateDecoder();
73 +#if (LIBAVCODEC_BUILD >= 4754)
74 +       LOG->Trace("Bitrate: %i", decoder->m_stream->codec->bit_rate );
75 +       LOG->Trace("Codec pixel format: %s", avcodec::avcodec_get_pix_fmt_name(decoder->m_stream->codec->pix_fmt) );
76 +#else
77         LOG->Trace("Bitrate: %i", decoder->m_stream->codec.bit_rate );
78         LOG->Trace("Codec pixel format: %s", avcodec::avcodec_get_pix_fmt_name(decoder->m_stream->codec.pix_fmt) );
79 +#endif
80  
81         /* Decode one frame, to guarantee that the texture is drawn when this function returns. */
82         int ret = decoder->GetFrame();
83 @@ -573,6 +597,17 @@
84         if ( stream == NULL )
85                 RageException::Throw( "AVCodec (%s): Couldn't find any video streams", GetID().filename.c_str() );
86  
87 +#if (LIBAVCODEC_BUILD >= 4754)
88 +       if( stream->codec->codec_id == avcodec::CODEC_ID_NONE )
89 +               RageException::ThrowNonfatal( "AVCodec (%s): Unsupported codec %08x", GetID().filename.c_str(), stream->codec->codec_tag );
90 +
91 +       avcodec::AVCodec *codec = avcodec::avcodec_find_decoder( stream->codec->codec_id );
92 +       if( codec == NULL )
93 +               RageException::Throw( "AVCodec (%s): Couldn't find decoder %i", GetID().filename.c_str(), stream->codec->codec_id );
94 +
95 +       LOG->Trace("Opening codec %s", codec->name );
96 +       ret = avcodec::avcodec_open( stream->codec, codec );
97 +#else
98         if( stream->codec.codec_id == avcodec::CODEC_ID_NONE )
99                 RageException::ThrowNonfatal( "AVCodec (%s): Unsupported codec %08x", GetID().filename.c_str(), stream->codec.codec_tag );
100  
101 @@ -582,6 +617,7 @@
102  
103         LOG->Trace("Opening codec %s", codec->name );
104         ret = avcodec::avcodec_open( &stream->codec, codec );
105 +#endif
106         if ( ret < 0 )
107                 RageException::Throw( averr_ssprintf(ret, "AVCodec (%s): Couldn't open codec \"%s\"", GetID().filename.c_str(), codec->name) );
108  
109 @@ -596,7 +632,11 @@
110  {
111         if( decoder->m_stream )
112         {
113 +#if (LIBAVCODEC_BUILD >= 4754)
114 +               avcodec::avcodec_close( decoder->m_stream->codec );
115 +#else
116                 avcodec::avcodec_close( &decoder->m_stream->codec );
117 +#endif
118                 decoder->m_stream = NULL;
119         }
120  
121 @@ -637,8 +677,13 @@
122         /* Cap the max texture size to the hardware max. */
123         actualID.iMaxSize = min( actualID.iMaxSize, DISPLAY->GetMaxTextureSize() );
124  
125 +#if (LIBAVCODEC_BUILD >= 4754)
126 +       m_iSourceWidth  = decoder->m_stream->codec->width;
127 +       m_iSourceHeight = decoder->m_stream->codec->height;
128 +#else
129         m_iSourceWidth  = decoder->m_stream->codec.width;
130         m_iSourceHeight = decoder->m_stream->codec.height;
131 +#endif
132  
133         /* image size cannot exceed max size */
134         m_iImageWidth = min( m_iSourceWidth, actualID.iMaxSize );
135 @@ -818,7 +863,11 @@
136                 m_FrameSkipMode = true;
137         }
138  
139 +#if (LIBAVCODEC_BUILD >= 4754)
140 +       if( m_FrameSkipMode && decoder->m_stream->codec->frame_number % 2 )
141 +#else
142         if( m_FrameSkipMode && decoder->m_stream->codec.frame_number % 2 )
143 +#endif
144                 return -1; /* skip */
145         
146         return 0;
This page took 0.127606 seconds and 3 git commands to generate.