* hexene/stagefright:
tools/build_libstagefright: fetch android system headers and libraries
libstagefright: reindent after previous commit
Merged-by: Michael Niedermayer <michaelni@gmx.at>
| ... | ... |
@@ -445,49 +445,49 @@ static av_cold int Stagefright_close(AVCodecContext *avctx) |
| 445 | 445 |
Frame *frame; |
| 446 | 446 |
|
| 447 | 447 |
if (s->thread_started) {
|
| 448 |
- if (!s->thread_exited) {
|
|
| 449 |
- s->stop_decode = 1; |
|
| 448 |
+ if (!s->thread_exited) {
|
|
| 449 |
+ s->stop_decode = 1; |
|
| 450 | 450 |
|
| 451 |
- // Make sure decode_thread() doesn't get stuck |
|
| 452 |
- pthread_mutex_lock(&s->out_mutex); |
|
| 453 |
- while (!s->out_queue->empty()) {
|
|
| 454 |
- frame = *s->out_queue->begin(); |
|
| 455 |
- s->out_queue->erase(s->out_queue->begin()); |
|
| 456 |
- if (frame->size) |
|
| 457 |
- frame->mbuffer->release(); |
|
| 458 |
- av_freep(&frame); |
|
| 459 |
- } |
|
| 460 |
- pthread_mutex_unlock(&s->out_mutex); |
|
| 451 |
+ // Make sure decode_thread() doesn't get stuck |
|
| 452 |
+ pthread_mutex_lock(&s->out_mutex); |
|
| 453 |
+ while (!s->out_queue->empty()) {
|
|
| 454 |
+ frame = *s->out_queue->begin(); |
|
| 455 |
+ s->out_queue->erase(s->out_queue->begin()); |
|
| 456 |
+ if (frame->size) |
|
| 457 |
+ frame->mbuffer->release(); |
|
| 458 |
+ av_freep(&frame); |
|
| 459 |
+ } |
|
| 460 |
+ pthread_mutex_unlock(&s->out_mutex); |
|
| 461 |
+ |
|
| 462 |
+ // Feed a dummy frame prior to signalling EOF. |
|
| 463 |
+ // This is required to terminate the decoder(OMX.SEC) |
|
| 464 |
+ // when only one frame is read during stream info detection. |
|
| 465 |
+ if (s->dummy_buf && (frame = (Frame*)av_mallocz(sizeof(Frame)))) {
|
|
| 466 |
+ frame->status = OK; |
|
| 467 |
+ frame->size = s->dummy_bufsize; |
|
| 468 |
+ frame->key = 1; |
|
| 469 |
+ frame->buffer = s->dummy_buf; |
|
| 470 |
+ pthread_mutex_lock(&s->in_mutex); |
|
| 471 |
+ s->in_queue->push_back(frame); |
|
| 472 |
+ pthread_cond_signal(&s->condition); |
|
| 473 |
+ pthread_mutex_unlock(&s->in_mutex); |
|
| 474 |
+ s->dummy_buf = NULL; |
|
| 475 |
+ } |
|
| 461 | 476 |
|
| 462 |
- // Feed a dummy frame prior to signalling EOF. |
|
| 463 |
- // This is required to terminate the decoder(OMX.SEC) |
|
| 464 |
- // when only one frame is read during stream info detection. |
|
| 465 |
- if (s->dummy_buf && (frame = (Frame*)av_mallocz(sizeof(Frame)))) {
|
|
| 466 |
- frame->status = OK; |
|
| 467 |
- frame->size = s->dummy_bufsize; |
|
| 468 |
- frame->key = 1; |
|
| 469 |
- frame->buffer = s->dummy_buf; |
|
| 470 | 477 |
pthread_mutex_lock(&s->in_mutex); |
| 471 |
- s->in_queue->push_back(frame); |
|
| 478 |
+ s->end_frame->status = ERROR_END_OF_STREAM; |
|
| 479 |
+ s->in_queue->push_back(s->end_frame); |
|
| 472 | 480 |
pthread_cond_signal(&s->condition); |
| 473 | 481 |
pthread_mutex_unlock(&s->in_mutex); |
| 474 |
- s->dummy_buf = NULL; |
|
| 482 |
+ s->end_frame = NULL; |
|
| 475 | 483 |
} |
| 476 | 484 |
|
| 477 |
- pthread_mutex_lock(&s->in_mutex); |
|
| 478 |
- s->end_frame->status = ERROR_END_OF_STREAM; |
|
| 479 |
- s->in_queue->push_back(s->end_frame); |
|
| 480 |
- pthread_cond_signal(&s->condition); |
|
| 481 |
- pthread_mutex_unlock(&s->in_mutex); |
|
| 482 |
- s->end_frame = NULL; |
|
| 483 |
- } |
|
| 484 |
- |
|
| 485 |
- pthread_join(s->decode_thread_id, NULL); |
|
| 485 |
+ pthread_join(s->decode_thread_id, NULL); |
|
| 486 | 486 |
|
| 487 |
- if (s->ret_frame.data[0]) |
|
| 488 |
- avctx->release_buffer(avctx, &s->ret_frame); |
|
| 487 |
+ if (s->ret_frame.data[0]) |
|
| 488 |
+ avctx->release_buffer(avctx, &s->ret_frame); |
|
| 489 | 489 |
|
| 490 |
- s->thread_started = false; |
|
| 490 |
+ s->thread_started = false; |
|
| 491 | 491 |
} |
| 492 | 492 |
|
| 493 | 493 |
while (!s->in_queue->empty()) {
|
| ... | ... |
@@ -5,12 +5,27 @@ if [ "$NDK" = "" ]; then |
| 5 | 5 |
export NDK=${HOME}/android-ndk
|
| 6 | 6 |
fi |
| 7 | 7 |
|
| 8 |
+echo "Fetching Android system headers" |
|
| 9 |
+git clone --depth=1 git://github.com/CyanogenMod/android_frameworks_base.git ../android-source/frameworks/base |
|
| 10 |
+git clone --depth=1 git://github.com/CyanogenMod/android_system_core.git ../android-source/system/core |
|
| 11 |
+ |
|
| 12 |
+echo "Fetching Android libraries for linking" |
|
| 13 |
+# Libraries from any froyo/gingerbread device/emulator should work |
|
| 14 |
+# fine, since the symbols used should be available on most of them. |
|
| 15 |
+if [ ! -f "../update-cm-7.0.3-N1-signed.zip" ]; then |
|
| 16 |
+ wget http://download.cyanogenmod.com/get/update-cm-7.0.3-N1-signed.zip -P../ |
|
| 17 |
+ unzip update-cm-7.0.3-N1-signed.zip system/lib/* -d../ |
|
| 18 |
+ mv ../system/lib ../android-libs |
|
| 19 |
+ rmdir ../system |
|
| 20 |
+fi |
|
| 21 |
+ |
|
| 22 |
+ |
|
| 8 | 23 |
SYSROOT=$NDK/platforms/android-9/arch-arm |
| 9 | 24 |
# Expand the prebuilt/* path into the correct one |
| 10 | 25 |
TOOLCHAIN=`echo $NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/*-x86` |
| 11 | 26 |
export PATH=$TOOLCHAIN/bin:$PATH |
| 12 |
-ANDROID_SOURCE=$HOME/android |
|
| 13 |
-ANDROID_LIBS=$HOME/glib |
|
| 27 |
+ANDROID_SOURCE=../android-source |
|
| 28 |
+ANDROID_LIBS=../android-libs |
|
| 14 | 29 |
|
| 15 | 30 |
rm -rf ../build/stagefright |
| 16 | 31 |
mkdir -p ../build/stagefright |