Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added: show profile information in codec info when available
Add patches to our ffmpeg that cause the profile information to be shown in parantheses after the codec name in the codec info. The core patches have been sent and applied upstream, while the profile arrays have been sent upstream but may undergo minor changes before being applied.
- Loading branch information
Showing
12 changed files
with
382 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
...s/dvdplayer/Codecs/ffmpeg/patches/0041-Add-av_get_profile_name-to-get-profile-names.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
From 060ec0a8294d912f694cf48546f1543805f83a48 Mon Sep 17 00:00:00 2001 | ||
From: Anssi Hannula <anssi.hannula@iki.fi> | ||
Date: Fri, 7 Jan 2011 22:27:26 +0000 | ||
Subject: [PATCH] Add av_get_profile_name() to get profile names. | ||
|
||
Patch by Anssi Hannula, anssi d hannula a iki d fi | ||
|
||
Originally committed as revision 26259 to svn://svn.ffmpeg.org/ffmpeg/trunk | ||
--- | ||
doc/APIchanges | 3 +++ | ||
libavcodec/avcodec.h | 22 ++++++++++++++++++++-- | ||
libavcodec/utils.c | 13 +++++++++++++ | ||
3 files changed, 36 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h | ||
index 7850e1d..309edae 100644 | ||
--- a/libavcodec/avcodec.h | ||
+++ b/libavcodec/avcodec.h | ||
@@ -2794,6 +2794,14 @@ typedef struct AVCodecContext { | ||
} AVCodecContext; | ||
|
||
/** | ||
+ * AVProfile. | ||
+ */ | ||
+typedef struct AVProfile { | ||
+ int profile; | ||
+ const char *name; ///< short name for the profile | ||
+} AVProfile; | ||
+ | ||
+/** | ||
* AVCodec. | ||
*/ | ||
typedef struct AVCodec { | ||
@@ -2834,6 +2842,7 @@ typedef struct AVCodec { | ||
const enum SampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 | ||
const int64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 | ||
uint8_t max_lowres; ///< maximum value for lowres supported by the decoder | ||
+ const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} | ||
} AVCodec; | ||
|
||
/** | ||
@@ -3394,6 +3403,15 @@ AVCodec *avcodec_find_decoder_by_name(const char *name); | ||
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); | ||
|
||
/** | ||
+ * Return a name for the specified profile, if available. | ||
+ * | ||
+ * @param codec the codec that is searched for the given profile | ||
+ * @param profile the profile value for which a name is requested | ||
+ * @return A name for the profile if found, NULL otherwise. | ||
+ */ | ||
+const char *av_get_profile_name(const AVCodec *codec, int profile); | ||
+ | ||
+/** | ||
* Set the fields of the given AVCodecContext to default values. | ||
* | ||
* @param s The AVCodecContext of which the fields should be set to default values. | ||
diff --git a/libavcodec/utils.c b/libavcodec/utils.c | ||
index ce74735..c11e4f5 100644 | ||
--- a/libavcodec/utils.c | ||
+++ b/libavcodec/utils.c | ||
@@ -966,6 +966,19 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) | ||
} | ||
} | ||
|
||
+const char *av_get_profile_name(const AVCodec *codec, int profile) | ||
+{ | ||
+ const AVProfile *p; | ||
+ if (profile == FF_PROFILE_UNKNOWN || !codec->profiles) | ||
+ return NULL; | ||
+ | ||
+ for (p = codec->profiles; p->profile != FF_PROFILE_UNKNOWN; p++) | ||
+ if (p->profile == profile) | ||
+ return p->name; | ||
+ | ||
+ return NULL; | ||
+} | ||
+ | ||
unsigned avcodec_version( void ) | ||
{ | ||
return LIBAVCODEC_VERSION_INT; | ||
-- | ||
1.7.3 | ||
|
55 changes: 55 additions & 0 deletions
55
xbmc/cores/dvdplayer/Codecs/ffmpeg/patches/0042-Show-profile-in-avcodec_string.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
From 2a81f4bde50f731074c1be7368128de49f78925a Mon Sep 17 00:00:00 2001 | ||
From: Anssi Hannula <anssi.hannula@iki.fi> | ||
Date: Sat, 8 Jan 2011 09:23:25 +0000 | ||
Subject: [PATCH] Show profile in avcodec_string(). | ||
|
||
Patch by Anssi Hannula, anssi d hannula a iki d fi | ||
|
||
Originally committed as revision 26264 to svn://svn.ffmpeg.org/ffmpeg/trunk | ||
--- | ||
libavcodec/utils.c | 8 ++++++++ | ||
1 files changed, 8 insertions(+), 0 deletions(-) | ||
|
||
diff --git a/libavcodec/utils.c b/libavcodec/utils.c | ||
index 0295147..8cc9299 100644 | ||
--- a/libavcodec/utils.c | ||
+++ b/libavcodec/utils.c | ||
@@ -871,6 +871,7 @@ size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_ta | ||
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) | ||
{ | ||
const char *codec_name; | ||
+ const char *profile = NULL; | ||
AVCodec *p; | ||
char buf1[32]; | ||
int bitrate; | ||
@@ -883,6 +884,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) | ||
|
||
if (p) { | ||
codec_name = p->name; | ||
+ profile = av_get_profile_name(p, enc->profile); | ||
} else if (enc->codec_id == CODEC_ID_MPEG2TS) { | ||
/* fake mpeg2 transport stream codec (currently not | ||
registered) */ | ||
@@ -902,6 +904,9 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) | ||
snprintf(buf, buf_size, | ||
"Video: %s%s", | ||
codec_name, enc->mb_decision ? " (hq)" : ""); | ||
+ if (profile) | ||
+ snprintf(buf + strlen(buf), buf_size - strlen(buf), | ||
+ " (%s)", profile); | ||
if (enc->pix_fmt != PIX_FMT_NONE) { | ||
snprintf(buf + strlen(buf), buf_size - strlen(buf), | ||
", %s", | ||
@@ -937,6 +942,9 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) | ||
snprintf(buf, buf_size, | ||
"Audio: %s", | ||
codec_name); | ||
+ if (profile) | ||
+ snprintf(buf + strlen(buf), buf_size - strlen(buf), | ||
+ " (%s)", profile); | ||
if (enc->sample_rate) { | ||
snprintf(buf + strlen(buf), buf_size - strlen(buf), | ||
", %d Hz", enc->sample_rate); | ||
-- | ||
1.7.3 | ||
|
51 changes: 51 additions & 0 deletions
51
...vdplayer/Codecs/ffmpeg/patches/0043-h264-add-profile-names-for-the-existing-defines.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
From 306bd2d20ada5782ea28037072e9d4f0cc9dae90 Mon Sep 17 00:00:00 2001 | ||
From: Anssi Hannula <anssi.hannula@iki.fi> | ||
Date: Fri, 7 Jan 2011 18:59:17 +0200 | ||
Subject: [PATCH 43/46] h264: add profile names for the existing defines | ||
|
||
Submitted upstream. | ||
|
||
--- | ||
libavcodec/h264.c | 13 +++++++++++++ | ||
1 files changed, 13 insertions(+), 0 deletions(-) | ||
|
||
diff --git a/libavcodec/h264.c b/libavcodec/h264.c | ||
index 40dc276..04caa9f 100644 | ||
--- a/libavcodec/h264.c | ||
+++ b/libavcodec/h264.c | ||
@@ -3354,6 +3354,17 @@ av_cold int ff_h264_decode_end(AVCodecContext *avctx) | ||
return 0; | ||
} | ||
|
||
+static const AVProfile profiles[] = { | ||
+ { FF_PROFILE_H264_BASELINE, "Baseline" }, | ||
+ { FF_PROFILE_H264_MAIN, "Main" }, | ||
+ { FF_PROFILE_H264_EXTENDED, "Extended" }, | ||
+ { FF_PROFILE_H264_HIGH, "High" }, | ||
+ { FF_PROFILE_H264_HIGH_10, "High 10" }, | ||
+ { FF_PROFILE_H264_HIGH_422, "High 4:2:2" }, | ||
+ { FF_PROFILE_H264_HIGH_444, "High 4:4:4" }, | ||
+ { FF_PROFILE_H264_CAVLC_444, "CAVLC 4:4:4" }, | ||
+ { FF_PROFILE_UNKNOWN }, | ||
+}; | ||
|
||
AVCodec h264_decoder = { | ||
"h264", | ||
@@ -3367,6 +3378,7 @@ AVCodec h264_decoder = { | ||
/*CODEC_CAP_DRAW_HORIZ_BAND |*/ CODEC_CAP_DR1 | CODEC_CAP_DELAY, | ||
.flush= flush_dpb, | ||
.long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), | ||
+ .profiles = profiles, | ||
}; | ||
|
||
#if CONFIG_H264_VDPAU_DECODER | ||
@@ -3383,5 +3395,6 @@ AVCodec h264_vdpau_decoder = { | ||
.flush= flush_dpb, | ||
.long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (VDPAU acceleration)"), | ||
.pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_H264, PIX_FMT_NONE}, | ||
+ .profiles = profiles, | ||
}; | ||
#endif | ||
-- | ||
1.7.3 | ||
|
Oops, something went wrong.