Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
havlenapetr committed Aug 2, 2010
1 parent 5115707 commit 3b3c53a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
17 changes: 14 additions & 3 deletions jni/libmediaplayer/decoder_video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,20 @@ bool DecoderVideo::prepare(const char *err)

mFrame = avcodec_alloc_frame();
if (mFrame == NULL) {
err = "Couldn't allocate mFrame";
return false;
}

mTempFrame = avcodec_alloc_frame();
if (mTempFrame == NULL) {
err = "Couldn't allocate mTempFrame";
return false;
}

if(Output::VideoDriver_getPixels(mConfig->width,
mConfig->height,
&pixels) != ANDROID_SURFACE_RESULT_SUCCESS) {
err = "Couldn't get pixels from android surface wrapper";
return false;
}

Expand All @@ -56,16 +64,16 @@ bool DecoderVideo::process(AVPacket *packet)

// Decode video frame
avcodec_decode_video(mCodecCtx,
mConfig->frame,
mTempFrame,
&completed,
packet->data,
packet->size);

if (completed) {
// Convert the image from its native format to RGB
sws_scale(mConfig->img_convert_ctx,
mConfig->frame->data,
mConfig->frame->linesize,
mTempFrame->data,
mTempFrame->linesize,
0,
mConfig->height,
mFrame->data,
Expand Down Expand Up @@ -105,5 +113,8 @@ bool DecoderVideo::decode(void* ptr)

// Free the RGB image
av_free(mFrame);
// Free the RGB image
av_free(mTempFrame);

return true;
}
1 change: 1 addition & 0 deletions jni/libmediaplayer/decoder_video.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class DecoderVideo : public IDecoder
private:
struct DecoderVideoConfig* mConfig;
AVFrame* mFrame;
AVFrame* mTempFrame;
bool prepare(const char *err);
bool decode(void* ptr);
bool process(AVPacket *packet);
Expand Down

0 comments on commit 3b3c53a

Please sign in to comment.