Changes of Revision 113

lightspark.spec Changed
x
 
1
@@ -20,7 +20,7 @@
2
 %bcond_without librtmp
3
 
4
 Name:           lightspark
5
-Version:        0.7.2.99+git20160814.1809
6
+Version:        0.7.2.99+git20160821.1502
7
 Release:        0
8
 Summary:        Modern, free, open-source flash player implementation
9
 License:        LGPL-3.0+
10
lightspark.tar.xz/src/asobject.cpp Changed
18
 
1
@@ -238,12 +238,10 @@
2
        }
3
        default:
4
        {
5
-           XMLList *xl=dynamic_cast<XMLList *>(r);
6
-           if(xl)
7
-               return xl->isEqual(this);
8
-           XML *x=dynamic_cast<XML *>(r);
9
-           if(x && x->hasSimpleContent())
10
-               return x->toString()==toString();
11
+           if (r->is<XMLList>())
12
+               return r->as<XMLList>()->isEqual(this);
13
+           if (r->is<XML>() && r->as<XML>()->hasSimpleContent())
14
+               return r->toString()==toString();
15
        }
16
    }
17
    if (r->is<ObjectConstructor>())
18
lightspark.tar.xz/src/backends/decoder.cpp Changed
251
 
1
@@ -318,17 +318,36 @@
2
 {
3
    if(datalen==0)
4
        return false;
5
-   int frameOk=0;
6
 #if HAVE_AVCODEC_SEND_PACKET && HAVE_AVCODEC_RECEIVE_FRAME
7
    AVPacket pkt;
8
    av_init_packet(&pkt);
9
    pkt.data=data;
10
    pkt.size=datalen;
11
    int ret = avcodec_send_packet(codecContext, &pkt);
12
-   if (ret == 0)
13
+   while (ret == 0)
14
+   {
15
        ret = avcodec_receive_frame(codecContext,frameIn);
16
-   frameOk=1;
17
-#elif HAVE_AVCODEC_DECODE_VIDEO2
18
+       if (ret != 0)
19
+       {
20
+           if (ret != AVERROR(EAGAIN))
21
+           {
22
+               LOG(LOG_INFO,"not decoded:"<<ret);
23
+               return false;
24
+           }
25
+       }
26
+       else
27
+       {
28
+           if(status==INIT && fillDataAndCheckValidity())
29
+               status=VALID;
30
+   
31
+           assert(frameIn->pts==(int64_t)AV_NOPTS_VALUE || frameIn->pts==0);
32
+   
33
+           copyFrameToBuffers(frameIn, time);
34
+       }
35
+   }
36
+#else
37
+   int frameOk=0;
38
+#if HAVE_AVCODEC_DECODE_VIDEO2
39
    AVPacket pkt;
40
    av_init_packet(&pkt);
41
    pkt.data=data;
42
@@ -353,19 +372,39 @@
43
 
44
        copyFrameToBuffers(frameIn, time);
45
    }
46
+#endif
47
    return true;
48
 }
49
 
50
 bool FFMpegVideoDecoder::decodePacket(AVPacket* pkt, uint32_t time)
51
 {
52
-   int frameOk=0;
53
-
54
 #if HAVE_AVCODEC_SEND_PACKET && HAVE_AVCODEC_RECEIVE_FRAME
55
    int ret = avcodec_send_packet(codecContext, pkt);
56
-   if (ret == 0)
57
+   while (ret == 0)
58
+   {
59
        ret = avcodec_receive_frame(codecContext,frameIn);
60
-   frameOk=1;
61
-#elif HAVE_AVCODEC_DECODE_VIDEO2
62
+       if (ret != 0)
63
+       {
64
+           if (ret != AVERROR(EAGAIN))
65
+           {
66
+               LOG(LOG_INFO,"not decoded:"<<ret);
67
+               return false;
68
+           }
69
+       }
70
+       else
71
+       {
72
+           if(status==INIT && fillDataAndCheckValidity())
73
+               status=VALID;
74
+   
75
+           assert(frameIn->pts==(int64_t)AV_NOPTS_VALUE || frameIn->pts==0);
76
+   
77
+           copyFrameToBuffers(frameIn, time);
78
+       }
79
+   }
80
+#else
81
+   int frameOk=0;
82
+
83
+#if HAVE_AVCODEC_DECODE_VIDEO2
84
    int ret=avcodec_decode_video2(codecContext, frameIn, &frameOk, pkt);
85
 #else
86
    int ret=avcodec_decode_video(codecContext, frameIn, &frameOk, pkt->data, pkt->size);
87
@@ -388,6 +427,7 @@
88
 
89
        copyFrameToBuffers(frameIn, time);
90
    }
91
+#endif
92
    return true;
93
 }
94
 
95
@@ -697,9 +737,7 @@
96
 
97
 uint32_t FFMpegAudioDecoder::decodeData(uint8_t* data, int32_t datalen, uint32_t time)
98
 {
99
-   FrameSamples& curTail=samplesBuffer.acquireLast();
100
-   int maxLen=AVCODEC_MAX_AUDIO_FRAME_SIZE;
101
-#if HAVE_AVCODEC_DECODE_AUDIO3 || HAVE_AVCODEC_DECODE_AUDIO4 || (HAVE_AVCODEC_SEND_PACKET && HAVE_AVCODEC_RECEIVE_FRAME)
102
+#if HAVE_AVCODEC_SEND_PACKET && HAVE_AVCODEC_RECEIVE_FRAME
103
    AVPacket pkt;
104
    av_init_packet(&pkt);
105
 
106
@@ -720,20 +758,71 @@
107
        pkt.size = combinedBuffer.size();
108
        overflowBuffer.clear();
109
    }
110
-#if HAVE_AVCODEC_SEND_PACKET && HAVE_AVCODEC_RECEIVE_FRAME
111
    av_frame_unref(frameIn);
112
    int ret = avcodec_send_packet(codecContext, &pkt);
113
-   if (ret == 0)
114
+   int maxLen = 0;
115
+   while (ret == 0)
116
+   {
117
+       
118
        ret = avcodec_receive_frame(codecContext,frameIn);
119
-   if(ret<0)
120
+       
121
+       if(ret != 0)
122
+       {
123
+           if (ret != AVERROR(EAGAIN))
124
+               LOG(LOG_ERROR,"not decoded audio:"<<ret );
125
+       }
126
+       else
127
+       {
128
+           FrameSamples& curTail=samplesBuffer.acquireLast();
129
+           int len = resampleFrameToS16(curTail);
130
+           maxLen = pkt.size - av_frame_get_pkt_size (frameIn);
131
+           curTail.len=len;
132
+           assert(!(curTail.len&0x80000000));
133
+           assert(len%2==0);
134
+           curTail.current=curTail.samples;
135
+           curTail.time=time;
136
+           samplesBuffer.commitLast();
137
+           if(status==INIT && fillDataAndCheckValidity())
138
+               status=VALID;
139
+       }
140
+   }
141
+   if (maxLen > 0)
142
    {
143
-       LOG(LOG_ERROR,"not decoded audio:"<<ret);
144
+       int tmpsize = pkt.size - maxLen;
145
+       uint8_t* tmpdata = pkt.data;
146
+       tmpdata += maxLen;
147
+
148
+       if (tmpsize > 0)
149
+       {
150
+           overflowBuffer.assign(tmpdata , tmpdata+tmpsize);
151
+       }
152
+   }
153
+   return maxLen;
154
+#else
155
+   FrameSamples& curTail=samplesBuffer.acquireLast();
156
+   int maxLen=AVCODEC_MAX_AUDIO_FRAME_SIZE;
157
+#if HAVE_AVCODEC_DECODE_AUDIO3 || HAVE_AVCODEC_DECODE_AUDIO4
158
+   AVPacket pkt;
159
+   av_init_packet(&pkt);
160
+
161
+   // If some data was left unprocessed on previous call,
162
+   // concatenate.
163
+   std::vector<uint8_t> combinedBuffer;
164
+   if (overflowBuffer.empty())
165
+   {
166
+       pkt.data=data;
167
+       pkt.size=datalen;
168
    }
169
    else
170
    {
171
-       maxLen = resampleFrameToS16(curTail);
172
+       combinedBuffer.assign(overflowBuffer.begin(), overflowBuffer.end());
173
+       if (datalen > 0)
174
+           combinedBuffer.insert(combinedBuffer.end(), data, data+datalen);
175
+       pkt.data = &combinedBuffer[0];
176
+       pkt.size = combinedBuffer.size();
177
+       overflowBuffer.clear();
178
    }
179
-#elif HAVE_AVCODEC_DECODE_AUDIO4
180
+#if HAVE_AVCODEC_DECODE_AUDIO4
181
    av_frame_unref(frameIn);
182
    int frameOk=0;
183
    int32_t ret=avcodec_decode_audio4(codecContext, frameIn, &frameOk, &pkt);
184
@@ -775,27 +864,43 @@
185
        status=VALID;
186
 
187
    return maxLen;
188
+#endif
189
 }
190
 
191
 uint32_t FFMpegAudioDecoder::decodePacket(AVPacket* pkt, uint32_t time)
192
 {
193
-   FrameSamples& curTail=samplesBuffer.acquireLast();
194
-   int maxLen=AVCODEC_MAX_AUDIO_FRAME_SIZE;
195
-
196
 #if HAVE_AVCODEC_SEND_PACKET && HAVE_AVCODEC_RECEIVE_FRAME
197
    av_frame_unref(frameIn);
198
    int ret = avcodec_send_packet(codecContext, pkt);
199
-   if (ret == 0)
200
-       ret = avcodec_receive_frame(codecContext,frameIn);
201
-   if(ret<0)
202
+   int maxLen = 0;
203
+   while (ret == 0)
204
    {
205
-       LOG(LOG_ERROR,"not decoded audio:"<<ret);
206
-   }
207
-   else
208
-   {
209
-       maxLen = resampleFrameToS16(curTail);
210
+       ret = avcodec_receive_frame(codecContext,frameIn);
211
+       if(ret != 0)
212
+       {
213
+           if (ret != AVERROR(EAGAIN))
214
+               LOG(LOG_ERROR,"not decoded audio:"<<ret);
215
+       }
216
+       else
217
+       {
218
+           FrameSamples& curTail=samplesBuffer.acquireLast();
219
+           int len = resampleFrameToS16(curTail);
220
+           maxLen = pkt->size - av_frame_get_pkt_size (frameIn);
221
+           curTail.len=len;
222
+           assert(!(curTail.len&0x80000000));
223
+           assert(len%2==0);
224
+           curTail.current=curTail.samples;
225
+           curTail.time=time;
226
+           samplesBuffer.commitLast();
227
+           if(status==INIT && fillDataAndCheckValidity())
228
+               status=VALID;
229
+       }
230
    }
231
-#elif HAVE_AVCODEC_DECODE_AUDIO4
232
+   return maxLen;
233
+#else
234
+   FrameSamples& curTail=samplesBuffer.acquireLast();
235
+   int maxLen=AVCODEC_MAX_AUDIO_FRAME_SIZE;
236
+#if HAVE_AVCODEC_DECODE_AUDIO4
237
    av_frame_unref(frameIn);
238
    int frameOk=0;
239
    int ret=avcodec_decode_audio4(codecContext, frameIn, &frameOk, pkt);
240
@@ -836,8 +941,9 @@
241
    curTail.time=time;
242
    samplesBuffer.commitLast();
243
    return maxLen;
244
+#endif
245
 }
246
-#if HAVE_AVCODEC_DECODE_AUDIO4
247
+#if HAVE_AVCODEC_DECODE_AUDIO4 || (HAVE_AVCODEC_SEND_PACKET && HAVE_AVCODEC_RECEIVE_FRAME)
248
 int FFMpegAudioDecoder::resampleFrameToS16(FrameSamples& curTail)
249
 {
250
    int sample_rate = getSys()->audioManager->forcedSampleRate() == -1 ? codecContext->sample_rate : getSys()->audioManager->forcedSampleRate();
251
lightspark.tar.xz/src/scripting/abc.cpp Changed
17
 
1
@@ -2075,6 +2075,15 @@
2
            _NR<ASObject> tmpo=obj->getVariableByMultiname(*mname,ASObject::SKIP_IMPL);
3
            if(!tmpo.isNull())
4
                return;
5
+
6
+           //Check if this already defined in parent applicationdomains
7
+           ASObject* target;
8
+           ASObject* oldDefinition=root->applicationDomain->getVariableAndTargetByMultiname(*mname, target);
9
+           if(oldDefinition && oldDefinition->getObjectType()==T_CLASS)
10
+           {
11
+               return;
12
+           }
13
+           
14
            ASObject* ret;
15
 
16
            QName className(mname->name_s_id,mname->ns[0].getImpl(obj->getSystemState()).nameId);
17
lightspark.tar.xz/src/scripting/toplevel/XML.cpp Changed
19
 
1
@@ -2489,13 +2489,11 @@
2
 {
3
    if (!isConstructed())
4
        return !r->isConstructed() || r->getObjectType() == T_NULL || r->getObjectType() == T_UNDEFINED;
5
-   XML *x=dynamic_cast<XML *>(r);
6
-   if(x)
7
-       return nodesEqual(this, x);
8
+   if(r->is<XML>())
9
+       return nodesEqual(this, r->as<XML>());
10
 
11
-   XMLList *xl=dynamic_cast<XMLList *>(r);
12
-   if(xl)
13
-       return xl->isEqual(this);
14
+   if(r->is<XMLList>())
15
+       return r->as<XMLList>()->isEqual(this);
16
 
17
    if(hasSimpleContent())
18
        return toString()==r->toString();
19
lightspark.tar.xz/src/scripting/toplevel/XMLList.cpp Changed
47
 
1
@@ -692,11 +692,10 @@
2
        for(; it!=nodes.end(); ++it)
3
        {
4
            _NR<ASObject> o=(*it)->getVariableByMultiname(name,opt);
5
-           XMLList *x=dynamic_cast<XMLList *>(o.getPtr());
6
-           if(!x)
7
+           if(!o->is<XMLList>())
8
                continue;
9
 
10
-           retnodes.insert(retnodes.end(), x->nodes.begin(), x->nodes.end());
11
+           retnodes.insert(retnodes.end(), o->as<XMLList>()->nodes.begin(), o->as<XMLList>()->nodes.end());
12
        }
13
 
14
        if(retnodes.size()==0 && (opt & XML_STRICT)!=0)
15
@@ -720,11 +719,10 @@
16
        for(; it!=nodes.end(); ++it)
17
        {
18
            _NR<ASObject> o=(*it)->getVariableByMultiname(name,opt);
19
-           XMLList *x=dynamic_cast<XMLList *>(o.getPtr());
20
-           if(!x)
21
+           if(!o->is<XMLList>())
22
                continue;
23
 
24
-           retnodes.insert(retnodes.end(), x->nodes.begin(), x->nodes.end());
25
+           retnodes.insert(retnodes.end(), o->as<XMLList>()->nodes.begin(), o->as<XMLList>()->nodes.end());
26
        }
27
 
28
        if(retnodes.size()==0 && (opt & XML_STRICT)!=0)
29
@@ -1159,14 +1157,13 @@
30
    if(nodes.size()==0 && r->getObjectType()==T_UNDEFINED)
31
        return true;
32
 
33
-   XMLList *x=dynamic_cast<XMLList *>(r);
34
-   if(x)
35
+   if(r->is<XMLList>())
36
    {
37
-       if(nodes.size()!=x->nodes.size())
38
+       if(nodes.size()!=r->as<XMLList>()->nodes.size())
39
            return false;
40
 
41
        for(unsigned int i=0; i<nodes.size(); i++)
42
-           if(!nodes[i]->isEqual(x->nodes[i].getPtr()))
43
+           if(!nodes[i]->isEqual(r->as<XMLList>()->nodes[i].getPtr()))
44
                return false;
45
 
46
        return true;
47