* hexene/scratchpad:
libstagefright: Explicitly free smart pointer objects
Changelog: Explain why C++ support is added, and that its optional
tools/build_libstagefright: rename build/libav to something neutral
Conflicts:
Changelog
Merged-by: Michael Niedermayer <michaelni@gmx.at>
| ... | ... |
@@ -58,7 +58,7 @@ struct StagefrightContext {
|
| 58 | 58 |
AVBitStreamFilterContext *bsfc; |
| 59 | 59 |
uint8_t* orig_extradata; |
| 60 | 60 |
int orig_extradata_size; |
| 61 |
- sp<MediaSource> source; |
|
| 61 |
+ sp<MediaSource> *source; |
|
| 62 | 62 |
List<Frame*> *in_queue, *out_queue; |
| 63 | 63 |
pthread_mutex_t in_mutex, out_mutex; |
| 64 | 64 |
pthread_cond_t condition; |
| ... | ... |
@@ -74,7 +74,7 @@ struct StagefrightContext {
|
| 74 | 74 |
int dummy_bufsize; |
| 75 | 75 |
|
| 76 | 76 |
OMXClient *client; |
| 77 |
- sp<MediaSource> decoder; |
|
| 77 |
+ sp<MediaSource> *decoder; |
|
| 78 | 78 |
const char *decoder_component; |
| 79 | 79 |
}; |
| 80 | 80 |
|
| ... | ... |
@@ -156,9 +156,9 @@ void* decode_thread(void *arg) |
| 156 | 156 |
decode_done = 1; |
| 157 | 157 |
s->end_frame = NULL; |
| 158 | 158 |
} else {
|
| 159 |
- frame->status = s->decoder->read(&buffer); |
|
| 159 |
+ frame->status = (*s->decoder)->read(&buffer); |
|
| 160 | 160 |
if (frame->status == OK) {
|
| 161 |
- sp<MetaData> outFormat = s->decoder->getFormat(); |
|
| 161 |
+ sp<MetaData> outFormat = (*s->decoder)->getFormat(); |
|
| 162 | 162 |
outFormat->findInt32(kKeyWidth , &frame->w); |
| 163 | 163 |
outFormat->findInt32(kKeyHeight, &frame->h); |
| 164 | 164 |
frame->size = buffer->range_length(); |
| ... | ... |
@@ -220,7 +220,8 @@ static av_cold int Stagefright_init(AVCodecContext *avctx) |
| 220 | 220 |
|
| 221 | 221 |
android::ProcessState::self()->startThreadPool(); |
| 222 | 222 |
|
| 223 |
- s->source = new CustomSource(avctx, meta); |
|
| 223 |
+ s->source = new sp<MediaSource>(); |
|
| 224 |
+ *s->source = new CustomSource(avctx, meta); |
|
| 224 | 225 |
s->in_queue = new List<Frame*>; |
| 225 | 226 |
s->out_queue = new List<Frame*>; |
| 226 | 227 |
s->client = new OMXClient; |
| ... | ... |
@@ -237,17 +238,18 @@ static av_cold int Stagefright_init(AVCodecContext *avctx) |
| 237 | 237 |
goto fail; |
| 238 | 238 |
} |
| 239 | 239 |
|
| 240 |
- s->decoder = OMXCodec::Create(s->client->interface(), meta, |
|
| 241 |
- false, s->source, NULL, |
|
| 240 |
+ s->decoder = new sp<MediaSource>(); |
|
| 241 |
+ *s->decoder = OMXCodec::Create(s->client->interface(), meta, |
|
| 242 |
+ false, *s->source, NULL, |
|
| 242 | 243 |
OMXCodec::kClientNeedsFramebuffer); |
| 243 |
- if (s->decoder->start() != OK) {
|
|
| 244 |
+ if ((*s->decoder)->start() != OK) {
|
|
| 244 | 245 |
av_log(avctx, AV_LOG_ERROR, "Cannot start decoder\n"); |
| 245 | 246 |
ret = -1; |
| 246 | 247 |
s->client->disconnect(); |
| 247 | 248 |
goto fail; |
| 248 | 249 |
} |
| 249 | 250 |
|
| 250 |
- outFormat = s->decoder->getFormat(); |
|
| 251 |
+ outFormat = (*s->decoder)->getFormat(); |
|
| 251 | 252 |
outFormat->findInt32(kKeyColorFormat, &colorFormat); |
| 252 | 253 |
if (colorFormat == OMX_QCOM_COLOR_FormatYVU420SemiPlanar || |
| 253 | 254 |
colorFormat == OMX_COLOR_FormatYUV420SemiPlanar) |
| ... | ... |
@@ -472,7 +474,7 @@ static av_cold int Stagefright_close(AVCodecContext *avctx) |
| 472 | 472 |
av_freep(&frame); |
| 473 | 473 |
} |
| 474 | 474 |
|
| 475 |
- s->decoder->stop(); |
|
| 475 |
+ (*s->decoder)->stop(); |
|
| 476 | 476 |
s->client->disconnect(); |
| 477 | 477 |
|
| 478 | 478 |
if (s->decoder_component) |
| ... | ... |
@@ -490,6 +492,8 @@ static av_cold int Stagefright_close(AVCodecContext *avctx) |
| 490 | 490 |
delete s->in_queue; |
| 491 | 491 |
delete s->out_queue; |
| 492 | 492 |
delete s->client; |
| 493 |
+ delete s->decoder; |
|
| 494 |
+ delete s->source; |
|
| 493 | 495 |
|
| 494 | 496 |
pthread_mutex_destroy(&s->in_mutex); |
| 495 | 497 |
pthread_mutex_destroy(&s->out_mutex); |
| ... | ... |
@@ -12,10 +12,10 @@ export PATH=$TOOLCHAIN/bin:$PATH |
| 12 | 12 |
ANDROID_SOURCE=$HOME/android |
| 13 | 13 |
ANDROID_LIBS=$HOME/glib |
| 14 | 14 |
|
| 15 |
-rm -rf ../build/libav |
|
| 16 |
-mkdir -p ../build/libav |
|
| 15 |
+rm -rf ../build/stagefright |
|
| 16 |
+mkdir -p ../build/stagefright |
|
| 17 | 17 |
|
| 18 |
-DEST=../build/libav |
|
| 18 |
+DEST=../build/stagefright |
|
| 19 | 19 |
FLAGS="--target-os=linux --cross-prefix=arm-linux-androideabi- --arch=arm --cpu=armv7-a" |
| 20 | 20 |
FLAGS="$FLAGS --sysroot=$SYSROOT" |
| 21 | 21 |
FLAGS="$FLAGS --disable-avdevice --disable-decoder=h264 --disable-decoder=h264_vdpau --enable-libstagefright-h264" |