Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-stagefright-plugins: 提交

external/stagefright-plugins


Commit MetaInfo

修订版5ab624e1bd993e300a9d4ae03adaeef6013aed35 (tree)
时间2013-11-13 20:45:53
作者Michael Chen <omxcodec@gmai...>
CommiterMichael Chen

Log Message

cleanup

更改概述

差异

--- a/libstagefright/FFmpegExtractor/FFmpegExtractor.cpp
+++ b/libstagefright/FFmpegExtractor/FFmpegExtractor.cpp
@@ -335,10 +335,12 @@ bool FFmpegExtractor::is_codec_supported(enum AVCodecID codec_id)
335335 return supported;
336336 }
337337
338-sp<MetaData> FFmpegExtractor::setVideoFormat(AVCodecContext *avctx)
338+sp<MetaData> FFmpegExtractor::setVideoFormat(AVStream *stream)
339339 {
340+ AVCodecContext *avctx = NULL;
340341 sp<MetaData> meta = NULL;
341342
343+ avctx = stream->codec;
342344 CHECK_EQ(avctx->codec_type, AVMEDIA_TYPE_VIDEO);
343345
344346 switch(avctx->codec_id) {
@@ -409,16 +411,19 @@ sp<MetaData> FFmpegExtractor::setVideoFormat(AVCodecContext *avctx)
409411 meta->setInt32(kKeyHeight, avctx->height);
410412 if (avctx->bit_rate > 0) {
411413 meta->setInt32(kKeyBitRate, avctx->bit_rate);
412- }
414+ }
415+ setDurationMetaData(stream, meta);
413416 }
414417
415418 return meta;
416419 }
417420
418-sp<MetaData> FFmpegExtractor::setAudioFormat(AVCodecContext *avctx)
421+sp<MetaData> FFmpegExtractor::setAudioFormat(AVStream *stream)
419422 {
423+ AVCodecContext *avctx = NULL;
420424 sp<MetaData> meta = NULL;
421425
426+ avctx = stream->codec;
422427 CHECK_EQ(avctx->codec_type, AVMEDIA_TYPE_AUDIO);
423428
424429 switch(avctx->codec_id) {
@@ -486,12 +491,13 @@ sp<MetaData> FFmpegExtractor::setAudioFormat(AVCodecContext *avctx)
486491 meta->setInt32(kKeySampleRate, avctx->sample_rate);
487492 meta->setInt32(kKeyBlockAlign, avctx->block_align);
488493 meta->setInt32(kKeySampleFormat, avctx->sample_fmt);
494+ setDurationMetaData(stream, meta);
489495 }
490496
491497 return meta;
492498 }
493499
494-void FFmpegExtractor::setStreamDurationMeta(AVStream *stream, sp<MetaData> &meta)
500+void FFmpegExtractor::setDurationMetaData(AVStream *stream, sp<MetaData> &meta)
495501 {
496502 AVCodecContext *avctx = stream->codec;
497503
@@ -574,14 +580,12 @@ int FFmpegExtractor::stream_component_open(int stream_index)
574580 ALOGV("video stream no extradata, but we can ignore it.");
575581 }
576582
577- meta = setVideoFormat(avctx);
583+ meta = setVideoFormat(mVideoStream);
578584 if (meta == NULL) {
579585 ALOGE("setVideoFormat failed");
580586 return -1;
581587 }
582588
583- setStreamDurationMeta(mVideoStream, meta);
584-
585589 ALOGV("create a video track");
586590 index = mTracks.add(
587591 stream_index, new Track(this, meta, mVideoStream, &mVideoQ));
@@ -614,14 +618,12 @@ int FFmpegExtractor::stream_component_open(int stream_index)
614618 ALOGV("audio stream no extradata, but we can ignore it.");
615619 }
616620
617- meta = setAudioFormat(avctx);
621+ meta = setAudioFormat(mAudioStream);
618622 if (meta == NULL) {
619623 ALOGE("setAudioFormat failed");
620624 return -1;
621625 }
622626
623- setStreamDurationMeta(mAudioStream, meta);
624-
625627 ALOGV("create a audio track");
626628 index = mTracks.add(
627629 stream_index, new Track(this, meta, mAudioStream, &mAudioQ));
--- a/libstagefright/FFmpegExtractor/FFmpegExtractor.h
+++ b/libstagefright/FFmpegExtractor/FFmpegExtractor.h
@@ -99,9 +99,9 @@ private:
9999 void setFFmpegDefaultOpts();
100100 void printTime(int64_t time);
101101 bool is_codec_supported(enum AVCodecID codec_id);
102- sp<MetaData> setVideoFormat(AVCodecContext *avctx);
103- sp<MetaData> setAudioFormat(AVCodecContext *avctx);
104- void setStreamDurationMeta(AVStream *stream, sp<MetaData> &meta);
102+ sp<MetaData> setVideoFormat(AVStream *stream);
103+ sp<MetaData> setAudioFormat(AVStream *stream);
104+ void setDurationMetaData(AVStream *stream, sp<MetaData> &meta);
105105 int stream_component_open(int stream_index);
106106 void stream_component_close(int stream_index);
107107 void reachedEOS(enum AVMediaType media_type);
Show on old repository browser