[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libmedia/ffmpeg/MediaParserFfmp...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog libmedia/ffmpeg/MediaParserFfmp... |
Date: |
Wed, 04 Jun 2008 20:14:41 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/06/04 20:14:41
Modified files:
. : ChangeLog
libmedia/ffmpeg: MediaParserFfmpeg.cpp MediaParserFfmpeg.h
Log message:
Impement getVideoInfo/getAudioInfo.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6821&r2=1.6822
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/ffmpeg/MediaParserFfmpeg.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/ffmpeg/MediaParserFfmpeg.h?cvsroot=gnash&r1=1.5&r2=1.6
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6821
retrieving revision 1.6822
diff -u -b -r1.6821 -r1.6822
--- ChangeLog 4 Jun 2008 20:12:32 -0000 1.6821
+++ ChangeLog 4 Jun 2008 20:14:40 -0000 1.6822
@@ -1,5 +1,10 @@
2008-06-04 Sandro Santilli <address@hidden>
+ * libmedia/ffmpeg/MediaParserFfmpeg.{cpp,h}:
+ Impement getVideoInfo/getAudioInfo.
+
+2008-06-04 Sandro Santilli <address@hidden>
+
* libmedia/ffmpeg/AudioDecoderFfmpeg.cpp: don't close audio codec
context if it wasn't opened.
* libmedia/ffmpeg/VideoDecoderFfmpeg.cpp: don't close video codec
Index: libmedia/ffmpeg/MediaParserFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/ffmpeg/MediaParserFfmpeg.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- libmedia/ffmpeg/MediaParserFfmpeg.cpp 4 Jun 2008 19:26:33 -0000
1.5
+++ libmedia/ffmpeg/MediaParserFfmpeg.cpp 4 Jun 2008 20:14:40 -0000
1.6
@@ -433,10 +433,29 @@
}
}
- // TODO: create _videoInfo and _audioInfo here ...
- //VideoInfo(int codeci, boost::uint16_t widthi, boost::uint16_t
heighti, boost::uint16_t frameRatei, boost::uint64_t durationi, codecType typei)
- if ( _videoStream) LOG_ONCE( log_unimpl("VideoInfo from _videoStream")
);
- if ( _audioStream) LOG_ONCE( log_unimpl("AudioInfo from _audioStream")
);
+ // Create VideoInfo
+ if ( _videoStream)
+ {
+ int codec = static_cast<int>(_videoStream->codec->codec_id); //
originally an enum CodecID
+ boost::uint16_t width = _videoStream->codec->width;
+ boost::uint16_t height = _videoStream->codec->height;
+ boost::uint16_t frameRate =
static_cast<boost::uint16_t>(as_double(_videoStream->r_frame_rate));
+ boost::uint64_t duration = _videoStream->codec_info_duration;
+
+ _videoInfo.reset( new VideoInfo(codec, width, height,
frameRate, duration, FFMPEG /*codec type*/) );
+ }
+
+ // Create AudioInfo
+ if ( _audioStream)
+ {
+ int codec = static_cast<int>(_audioStream->codec->codec_id); //
originally an enum CodecID
+ boost::uint16_t sampleRate = _audioStream->codec->sample_rate;
+ boost::uint16_t sampleSize =
SampleFormatToSampleSize(_audioStream->codec->sample_fmt);
+ bool stereo = (_audioStream->codec->channels == 2);
+ boost::uint64_t duration = _videoStream->codec_info_duration;
+
+ _audioInfo.reset( new AudioInfo(codec, sampleRate, sampleSize,
stereo, duration, FFMPEG /*codec type*/) );
+ }
}
@@ -517,6 +536,30 @@
return in.get_position();
}
+boost::uint16_t
+MediaParserFfmpeg::SampleFormatToSampleSize(SampleFormat fmt)
+{
+ switch (fmt)
+ {
+ case SAMPLE_FMT_U8: // unsigned 8 bits
+ return 1;
+
+ case SAMPLE_FMT_S16: // signed 16 bits
+ case SAMPLE_FMT_FLT: // float
+ return 2;
+
+ case SAMPLE_FMT_S24: // signed 24 bits
+ return 3;
+
+ case SAMPLE_FMT_S32: // signed 32 bits
+ return 4;
+
+ case SAMPLE_FMT_NONE:
+ default:
+ return 8; // arbitrary value
+ }
+}
+
} // end of gnash::media namespace
} // end of gnash namespace
Index: libmedia/ffmpeg/MediaParserFfmpeg.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/ffmpeg/MediaParserFfmpeg.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- libmedia/ffmpeg/MediaParserFfmpeg.h 4 Jun 2008 19:26:33 -0000 1.5
+++ libmedia/ffmpeg/MediaParserFfmpeg.h 4 Jun 2008 20:14:40 -0000 1.6
@@ -250,6 +250,11 @@
/// The last parsed position, for getBytesLoaded
boost::uint64_t _lastParsedPosition;
+ /// Return sample size from SampleFormat
+ //
+ /// TODO: move somewhere in ffmpeg utils..
+ ///
+ boost::uint16_t SampleFormatToSampleSize(SampleFormat fmt);
};