mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 16:21:17 +00:00
sys/dshowdecwrapper/: Add AAC, AC3 to handled codecs.
Original commit message from CVS: Based on patch by: Alessandro Decina <alessandro@nnva.org> * sys/dshowdecwrapper/gstdshowaudiodec.c: * sys/dshowdecwrapper/gstdshowdecwrapper.h: * sys/dshowdecwrapper/gstdshowvideodec.c: Add AAC, AC3 to handled codecs. Fix handling of flush events. Improve debug/error output. Fix a number of typos in comments and variable names.
This commit is contained in:
parent
7399002e2b
commit
50eafabdd5
4 changed files with 74 additions and 20 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2008-07-08 Michael Smith <msmith@songbirdnest.com>
|
||||
|
||||
Based on patch by: Alessandro Decina <alessandro@nnva.org>
|
||||
* sys/dshowdecwrapper/gstdshowaudiodec.c:
|
||||
* sys/dshowdecwrapper/gstdshowdecwrapper.h:
|
||||
* sys/dshowdecwrapper/gstdshowvideodec.c:
|
||||
Add AAC, AC3 to handled codecs.
|
||||
Fix handling of flush events.
|
||||
Improve debug/error output.
|
||||
Fix a number of typos in comments and variable names.
|
||||
|
||||
2008-07-08 Thijs Vermeir <thijsvermeir@gmail.com>
|
||||
|
||||
patch by: Ilja Pavkovic <illsen@gumblfarz.de>
|
||||
|
|
|
@ -79,9 +79,9 @@ static gboolean gst_dshowaudiodec_flush (GstDshowAudioDec * adec);
|
|||
static gboolean gst_dshowaudiodec_get_filter_settings (GstDshowAudioDec * adec);
|
||||
static gboolean gst_dshowaudiodec_setup_graph (GstDshowAudioDec * adec);
|
||||
|
||||
/* gobal variable */
|
||||
const long bitrates[2][3][16] = {
|
||||
/* version 0 */
|
||||
/* global variable */
|
||||
static const long bitrates[2][3][16] = {
|
||||
/* mpeg 1 */
|
||||
{
|
||||
/* one list per layer 1-3 */
|
||||
{0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000,
|
||||
|
@ -91,7 +91,7 @@ const long bitrates[2][3][16] = {
|
|||
{0, 8000, 16000, 24000, 32000, 40000, 48000, 56000, 64000, 80000, 96000,
|
||||
112000, 128000, 144000, 160000, 0},
|
||||
},
|
||||
/* version 1 */
|
||||
/* mpeg 2 */
|
||||
{
|
||||
/* one list per layer 1-3 */
|
||||
{0, 32000, 64000, 96000, 128000, 160000, 192000, 224000, 256000,
|
||||
|
@ -112,6 +112,9 @@ const long bitrates[2][3][16] = {
|
|||
#define GUID_MEDIASUBTYPE_WMS {0x0000000a, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }}
|
||||
#define GUID_MEDIASUBTYPE_MP3 {0x00000055, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }}
|
||||
#define GUID_MEDIASUBTYPE_MPEG1AudioPayload {0x00000050, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9b, 0x71 }}
|
||||
#define GUID_MEDIASUBTYPE_AAC {0x000000FF, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9b, 0x71 }}
|
||||
#define GUID_MEDIASUBTYPE_AC3 {0x00002000, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9b, 0x71 }}
|
||||
|
||||
|
||||
static const CodecEntry audio_dec_codecs[] = {
|
||||
{"dshowadec_wma1",
|
||||
|
@ -176,7 +179,7 @@ static const CodecEntry audio_dec_codecs[] = {
|
|||
},
|
||||
{"dshowadec_mpeg1",
|
||||
"MPEG-1 Layer 1,2,3 Audio",
|
||||
"MPEG Layer-3 Decoder",
|
||||
"MPEG Layer-3 Decoder, MP3 Decoder DMO",
|
||||
0x00000055,
|
||||
GUID_MEDIATYPE_AUDIO, GUID_MEDIASUBTYPE_MP3,
|
||||
"audio/mpeg, "
|
||||
|
@ -189,13 +192,37 @@ static const CodecEntry audio_dec_codecs[] = {
|
|||
"width = (int) { 1, 8, 16 }, depth = (int) { 1, 8, 16 }, "
|
||||
"signed = (boolean) true, endianness = (int) "
|
||||
G_STRINGIFY (G_LITTLE_ENDIAN)
|
||||
}
|
||||
},
|
||||
{"dshowadec_aac",
|
||||
"AAC decoder",
|
||||
"ffdshow",
|
||||
0x000000FF,
|
||||
GUID_MEDIATYPE_AUDIO, GUID_MEDIASUBTYPE_AAC,
|
||||
"audio/mpeg, mpegversion = { 2, 4 }",
|
||||
GUID_MEDIATYPE_AUDIO, GUID_MEDIASUBTYPE_PCM,
|
||||
"audio/x-raw-int, "
|
||||
"width = (int) { 1, 8, 16 }, depth = (int) { 1, 8, 16 }, "
|
||||
"signed = (boolean) true, endianness = (int) "
|
||||
G_STRINGIFY (G_LITTLE_ENDIAN)
|
||||
},
|
||||
{"dshowadec_ac3",
|
||||
"AC3 decoder",
|
||||
NULL,
|
||||
0x00002000,
|
||||
GUID_MEDIATYPE_AUDIO, GUID_MEDIASUBTYPE_AC3,
|
||||
"audio/x-ac3",
|
||||
GUID_MEDIATYPE_AUDIO, GUID_MEDIASUBTYPE_PCM,
|
||||
"audio/x-raw-int, "
|
||||
"width = (int) { 1, 8, 16 }, depth = (int) { 1, 8, 16 }, "
|
||||
"signed = (boolean) true, endianness = (int) "
|
||||
G_STRINGIFY (G_LITTLE_ENDIAN)
|
||||
},
|
||||
};
|
||||
|
||||
/* Private map used when dshowadec_mpeg is loaded with layer=1 or 2.
|
||||
* The problem is that gstreamer don't care about caps like layer when connecting pads.
|
||||
* The problem is that gstreamer doesn't care about caps like layer when connecting pads.
|
||||
* So I've only one element handling mpeg audio in the public codecs map and
|
||||
* when it's loaded for mp3, I'm releasing mpeg audio decoder and replace it by
|
||||
* when it's loaded for mp3, I release the mpeg audio decoder and replace it by
|
||||
* the one described in this private map.
|
||||
*/
|
||||
static const CodecEntry audio_mpeg_1_2[] = { "dshowadec_mpeg_1_2",
|
||||
|
@ -307,7 +334,6 @@ gst_dshowaudiodec_init (GstDshowAudioDec * adec,
|
|||
adec->rate = 0;
|
||||
adec->layer = 0;
|
||||
adec->codec_data = NULL;
|
||||
|
||||
adec->last_ret = GST_FLOW_OK;
|
||||
|
||||
CoInitializeEx (NULL, COINIT_MULTITHREADED);
|
||||
|
@ -582,6 +608,7 @@ gst_dshowaudiodec_sink_event (GstPad * pad, GstEvent * event)
|
|||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_FLUSH_STOP:{
|
||||
gst_dshowaudiodec_flush (adec);
|
||||
adec->last_ret = GST_FLOW_OK;
|
||||
ret = gst_pad_event_default (pad, event);
|
||||
break;
|
||||
}
|
||||
|
@ -650,6 +677,7 @@ gst_dshowaudiodec_setup_graph (GstDshowAudioDec * adec)
|
|||
IPin *output_pin = NULL, *input_pin = NULL;
|
||||
IGstDshowInterface *gstdshowinterface = NULL;
|
||||
CodecEntry *codec_entry = klass->entry;
|
||||
char err_buf[1024];
|
||||
|
||||
if (adec->layer != 0) {
|
||||
if (adec->layer == 1 || adec->layer == 2) {
|
||||
|
@ -663,10 +691,10 @@ gst_dshowaudiodec_setup_graph (GstDshowAudioDec * adec)
|
|||
codec_entry->input_subtype,
|
||||
codec_entry->output_majortype,
|
||||
codec_entry->output_subtype,
|
||||
codec_entry->prefered_filter_substring, &adec->decfilter);
|
||||
codec_entry->preferred_filter_substring, &adec->decfilter);
|
||||
IFilterGraph_AddFilter (adec->filtergraph, adec->decfilter, L"decoder");
|
||||
} else {
|
||||
/* mp3 don't need to negociate with MPEG1WAVEFORMAT */
|
||||
/* mp3 doesn't need to negotiate with MPEG1WAVEFORMAT */
|
||||
adec->layer = 0;
|
||||
}
|
||||
}
|
||||
|
@ -812,8 +840,13 @@ gst_dshowaudiodec_setup_graph (GstDshowAudioDec * adec)
|
|||
IFilterGraph_ConnectDirect (adec->filtergraph, output_pin, input_pin,
|
||||
NULL);
|
||||
if (hres != S_OK) {
|
||||
if (!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
0, hres, 0, err_buf, 1024, NULL))
|
||||
err_buf[0] = 0;
|
||||
|
||||
GST_ELEMENT_ERROR (adec, CORE, NEGOTIATION,
|
||||
("Can't connect fakesrc with decoder (error=%d)", hres), (NULL));
|
||||
("Can't connect fakesrc with decoder (error=%d %s)", hres, err_buf),
|
||||
(NULL));
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -858,7 +891,7 @@ gst_dshowaudiodec_setup_graph (GstDshowAudioDec * adec)
|
|||
|
||||
IGstDshowInterface_gst_set_media_type (gstdshowinterface, &output_mediatype);
|
||||
IGstDshowInterface_gst_set_buffer_callback (gstdshowinterface,
|
||||
gst_dshowaudiodec_push_buffer, (byte *) adec);
|
||||
(byte *) gst_dshowaudiodec_push_buffer, (byte *) adec);
|
||||
IGstDshowInterface_Release (gstdshowinterface);
|
||||
gstdshowinterface = NULL;
|
||||
|
||||
|
@ -895,15 +928,25 @@ gst_dshowaudiodec_setup_graph (GstDshowAudioDec * adec)
|
|||
IFilterGraph_ConnectDirect (adec->filtergraph, output_pin, input_pin,
|
||||
NULL);
|
||||
if (hres != S_OK) {
|
||||
if (!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
0, hres, 0, err_buf, 1024, NULL))
|
||||
err_buf[0] = 0;
|
||||
|
||||
GST_ELEMENT_ERROR (adec, CORE, NEGOTIATION,
|
||||
("Can't connect decoder with fakesink (error=%d)", hres), (NULL));
|
||||
("Can't connect decoder with fakesink (error=%d %s)", hres, err_buf),
|
||||
(NULL));
|
||||
goto end;
|
||||
}
|
||||
|
||||
hres = IMediaFilter_Run (adec->mediafilter, -1);
|
||||
if (hres != S_OK) {
|
||||
if (!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
0, hres, 0, err_buf, 1024, NULL))
|
||||
err_buf[0] = 0;
|
||||
|
||||
GST_ELEMENT_ERROR (adec, CORE, NEGOTIATION,
|
||||
("Can't run the directshow graph (error=%d)", hres), (NULL));
|
||||
("Can't run the directshow graph (error=%d %s)", hres, err_buf),
|
||||
(NULL));
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -1017,7 +1060,7 @@ gst_dshowaudiodec_create_graph_and_filters (GstDshowAudioDec * adec)
|
|||
klass->entry->input_subtype,
|
||||
klass->entry->output_majortype,
|
||||
klass->entry->output_subtype,
|
||||
klass->entry->prefered_filter_substring, &adec->decfilter)) {
|
||||
klass->entry->preferred_filter_substring, &adec->decfilter)) {
|
||||
GST_ELEMENT_ERROR (adec, STREAM, FAILED,
|
||||
("Can't create an instance of the decoder filter"), (NULL));
|
||||
goto error;
|
||||
|
@ -1153,7 +1196,7 @@ dshow_adec_register (GstPlugin * plugin)
|
|||
audio_dec_codecs[i].input_subtype,
|
||||
audio_dec_codecs[i].output_majortype,
|
||||
audio_dec_codecs[i].output_subtype,
|
||||
audio_dec_codecs[i].prefered_filter_substring, NULL)) {
|
||||
audio_dec_codecs[i].preferred_filter_substring, NULL)) {
|
||||
|
||||
GST_CAT_DEBUG (dshowaudiodec_debug, "Registering %s",
|
||||
audio_dec_codecs[i].element_name);
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
typedef struct _CodecEntry {
|
||||
gchar *element_name;
|
||||
gchar *element_longname;
|
||||
gchar *prefered_filter_substring;
|
||||
gchar *preferred_filter_substring;
|
||||
gint32 format;
|
||||
GUID input_majortype;
|
||||
GUID input_subtype;
|
||||
|
|
|
@ -978,7 +978,7 @@ gst_dshowvideodec_create_graph_and_filters (GstDshowVideoDec * vdec)
|
|||
klass->entry->input_subtype,
|
||||
klass->entry->output_majortype,
|
||||
klass->entry->output_subtype,
|
||||
klass->entry->prefered_filter_substring, &vdec->decfilter)) {
|
||||
klass->entry->preferred_filter_substring, &vdec->decfilter)) {
|
||||
GST_ELEMENT_ERROR (vdec, STREAM, FAILED, ("Can't create an instance "
|
||||
"of the decoder filter"), (NULL));
|
||||
goto error;
|
||||
|
@ -1111,7 +1111,7 @@ dshow_vdec_register (GstPlugin * plugin)
|
|||
video_dec_codecs[i].input_subtype,
|
||||
video_dec_codecs[i].output_majortype,
|
||||
video_dec_codecs[i].output_subtype,
|
||||
video_dec_codecs[i].prefered_filter_substring, NULL)) {
|
||||
video_dec_codecs[i].preferred_filter_substring, NULL)) {
|
||||
|
||||
GST_CAT_DEBUG (dshowvideodec_debug, "Registering %s",
|
||||
video_dec_codecs[i].element_name);
|
||||
|
|
Loading…
Reference in a new issue